]> jfr.im git - irc/freenode/jbnc.git/commitdiff
Update bouncer.js
authorMadriix <redacted>
Fri, 31 Jul 2020 04:10:36 +0000 (06:10 +0200)
committerGitHub <redacted>
Fri, 31 Jul 2020 04:10:36 +0000 (06:10 +0200)
Attempt to fix some crashes due to "undefined"

bouncer.js

index 446b5d3893372ebc3f84ae5e4182faaf47c0c003..7352e00ad00af217e240b53300d74ace4807b3ef 100644 (file)
@@ -222,7 +222,7 @@ server = doServer(tlsOptions,function(socket) {
               }
               else if(commands[1]) {
                 this.irc.nick=commands[1].trim();
-                if(this.irc.user) {
+                /*if(this.irc.user) {
                   this.hash=hash(this.irc.nick+this.irc.user+this.irc.password+this.irc.server+this.irc.port.toString());
                   if(connections[socket.hash]) {
                     clientReconnect(this);
@@ -230,7 +230,7 @@ server = doServer(tlsOptions,function(socket) {
                   else {
                     clientConnect(this);
                   }
-                }
+                }*/
               }
               break;
             case 'USER':
@@ -446,9 +446,11 @@ server = doServer(tlsOptions,function(socket) {
                     break;
                   case 'QUIT':
                     this.write(":*jbnc NOTICE * :Sayonara.\n");
-                    connections[this.hash].write("QUIT :jbnc gateway\n");
-                    connections[this.hash].end();
-                    delete connections[this.hash];
+                    if (typeof connections[this.hash] !== 'undefined') {
+                      connections[this.hash].write("QUIT :jbnc gateway\n");
+                      connections[this.hash].end();
+                      delete connections[this.hash];
+                    }
                     break;
                   case 'PASS':
                     if(command[3]) {
@@ -612,8 +614,14 @@ function clientReconnect(socket) {
       socket.write("@time=null;msgid=null :"+connection.nick+"!"+connection.ircuser+"@"+connection.host+" JOIN :"+_channel.name+"\n");
       _mode_params='';
     
-      if ( typeof _channel.modes === 'undefined' )
-        _channel.modes = "";
+        if ( typeof _channel.modes === 'undefined' )
+          _channel.modes = "";
+
+        if ( typeof _channel.topic === 'undefined' )
+          _channel.topic = "";
+
+        if ( typeof _channel.topic === 'undefined' )
+          _channel.topic = "";
     
       for(x=0;x<_channel.modes.length;x++) {
         switch(_channel.modes[x]) {