Skip to content

Commit d9fdac5

Browse files
committed
IRCv3 Monitor S v2
A new, more efficient version, better than pull #65
1 parent fa18b54 commit d9fdac5

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

bouncer.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const SERVER_PORT = BOUNCER_MODE=='gateway'?(config.serverPort?config.serverPort
4040
const INGRESSWEBIRC = config.ingresswebircPassword?config.ingresswebircPassword:'';
4141
const SERVER = BOUNCER_MODE=='gateway'?(config.server?config.server:''):'';
4242
const DEBUG = config.debug?config.debug:false;
43-
const IRCV3_MONITOR = config.ircv3Monitor?true:false;
4443

4544

4645
// Reload passwords on sighup
@@ -320,6 +319,21 @@ server = doServer(tlsOptions,function(socket) {
320319
case 'QUIT':
321320
this.end();
322321
break;
322+
case 'MONITOR':
323+
if(this.hash && connections[this.hash]) {
324+
if(command[1]=="+"){
325+
if(!connections[this.hash].ircv3Monitor)
326+
connections[this.hash].ircv3Monitor=true;
327+
connections[this.hash].write("MONITOR + "+command.slice(2).toString()+"\n");
328+
}
329+
else if(command[1]=="-"){
330+
connections[this.hash].write("MONITOR - "+command.slice(2).toString()+"\n");
331+
}
332+
else {
333+
connections[this.hash].write("MONITOR "+command.slice(1).toString()+"\n");
334+
}
335+
}
336+
break;
323337
case 'CAP':
324338
this.write(":*jbnc NOTICE * :*** No CAPabilities available. ***\n");
325339
continue;
@@ -646,7 +660,7 @@ function clientReconnect(socket) {
646660
socket.write(connection.connectbuf+"\n");
647661
if(connection.nick!=socket.irc.nick)
648662
socket.write(":"+connection.nick_original+" NICK "+connection.nick+"\n");
649-
if (IRCV3_MONITOR)
663+
if(connections[this.hash].ircv3Monitor)
650664
connection.write("MONITOR S\n");
651665
if(!connection.connected) {
652666
connection.write("AWAY\n");
@@ -810,6 +824,7 @@ function clientConnect(socket) {
810824
connection.opmode = BOUNCER_DEFAULT_OPMODE;
811825
connection.userhostInNames=false;
812826
connection.messagetags=false;
827+
connection.ircv3Monitor=false;
813828

814829
// Temp Buffer
815830
connection._buffer='';

examples/example.conf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
"bouncerTimeout":86400,
1919
"bufferMaxSize":52428800,
2020
"bouncerDefaultOpmode":false,
21-
22-
"ircv3Monitor": false,
23-
21+
2422
"debug":false
2523
}

0 commit comments

Comments
 (0)