From fe3e2c1af76447d0bf5adc873730c80b94a19f67 Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Wed, 21 Nov 2012 20:21:57 +0000 Subject: [PATCH] Remove time-delayed sending of registration info --- server/irc/commands.js | 13 +++++-------- server/irc/connection.js | 22 ++++------------------ 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/server/irc/commands.js b/server/irc/commands.js index cee26cf..a973716 100644 --- a/server/irc/commands.js +++ b/server/irc/commands.js @@ -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 diff --git a/server/irc/connection.js b/server/irc/connection.js index 21f9942..887903d 100644 --- a/server/irc/connection.js +++ b/server/irc/connection.js @@ -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; -- 2.25.1