Remove time-delayed sending of registration info
authorJack Allnutt <m2ys4u@Gmail.com>
Wed, 21 Nov 2012 20:21:57 +0000 (20:21 +0000)
committerJack Allnutt <m2ys4u@Gmail.com>
Wed, 21 Nov 2012 20:21:57 +0000 (20:21 +0000)
server/irc/commands.js
server/irc/connection.js

index cee26cfcee33b23a75ea51a37baa9d80604d9e16..a973716661abeb02ac5c76103aa42833ab560adb 100644 (file)
@@ -457,7 +457,6 @@ var listeners = {
                         } else {
                             this.irc_connection.write('CAP END');
                             this.irc_connection.cap_negotation = false;
-                            this.irc_connection.register();
                         }
                         break;
                     case 'ACK':
@@ -472,7 +471,6 @@ var listeners = {
                             } else {
                                 this.irc_connection.write('CAP END');
                                 this.irc_connection.cap_negotation = false;
-                                this.irc_connection.register();
                             }
                         }
                         break;
@@ -483,7 +481,6 @@ var listeners = {
                         if (this.irc_connection.cap.requested.length > 0) {
                             this.irc_connection.write('CAP END');
                             this.irc_connection.cap_negotation = false;
-                            this.irc_connection.register();
                         }
                         break;
                     case 'LIST':
@@ -507,7 +504,6 @@ var listeners = {
                 } else {
                     this.irc_connection.write('CAP END');
                     this.irc_connection.cap_negotation = false;
-                    this.irc_connection.register();
                 }
             },
     'AWAY':                 function (command) {
@@ -517,18 +513,19 @@ var listeners = {
                 this.irc_connection.write('CAP END');
                 this.irc_connection.cap_negotation = false;
                 this.irc_connection.sasl = true;
-                this.irc_connection.register();
             },
     'RPL_SASLLOGGEDIN':     function (command) {
-                // noop
+                if (this.irc_connection.cap_negotation === false) {
+                    this.irc_connection.write('CAP END');
+                }
             },
     'ERR_SASLNOTAUTHORISED':function (command) {
                 this.irc_connection.write('CAP END');
                 this.irc_connection.cap_negotation = false;
-                this.irc_connection.register();
             },
     'ERR_SASLABORTED':      function (command) {
-                // noop
+                this.irc_connection.write('CAP END');
+                this.irc_connection.cap_negotation = false;
             },
     'ERR_SASLALREADYAUTHED':function (command) {
                 // noop
index 21f9942a942a1ae594912849a2bdf12cf213ebea..887903d2e73a90e52a8a35e0de924d695e8c13de 100644 (file)
@@ -105,31 +105,17 @@ var connect_handler = function () {
 
     this.write('CAP LS');
 
-    this.registration_timeout = setTimeout(function () {
-        that.register();
-    }, 1000);
-    
-    this.connected = true;
-    this.emit('connected');
-};
-
-IrcConnection.prototype.register = function () {
-    if (this.registration_timeout !== null) {
-        clearTimeout(this.registeration_timeout);
-        this.registration_timeout = null;
-    }
-    if ((this.password) && (!this.sasl)) {
+    if (this.password) {
         this.write('PASS ' + this.password);
     }
     this.write('NICK ' + this.nick);
     this.write('USER ' + this.username + ' 0 0 :' + '[www.kiwiirc.com] ' + this.nick);
-    if (this.cap_negotation) {
-        this.write('CAP END');
-    }
+    
+    this.connected = true;
+    this.emit('connected');
 };
 
 
-
 function findWebIrc(connect_data) {
     var webirc_pass = global.config.webirc_pass;
     var ip_as_username = global.config.ip_as_username;