From ebe178d6ee5515c04e20c102c00675a38350ca0e Mon Sep 17 00:00:00 2001 From: Darren Date: Thu, 31 Jan 2013 12:54:15 +0000 Subject: [PATCH] ERR_PASSWORDMISMATCH; IrcServer disposing --- server/irc/commands.js | 4 ++++ server/irc/connection.js | 5 +++++ server/irc/server.js | 15 +++++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/server/irc/commands.js b/server/irc/commands.js index 9f32251..1678b72 100644 --- a/server/irc/commands.js +++ b/server/irc/commands.js @@ -45,6 +45,7 @@ var irc_numerics = { ERR_NICKNAMEINUSE: '433', ERR_USERNOTINCHANNEL: '441', ERR_NOTONCHANNEL: '442', + ERR_PASSWDMISMATCH: '464', ERR_NOTREGISTERED: '451', ERR_LINKCHANNEL: '470', ERR_CHANNELISFULL: '471', @@ -570,6 +571,9 @@ var listeners = { reason: command.trailing }); }, + ERR_PASSWDMISMATCH: function (command) { + this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':password_mismatch', {}); + }, ERR_LINKCHANNEL: function (command) { this.irc_connection.emit('server:' + this.irc_connection.irc_host.hostname + ':channel_redirect', { from: command.params[1], diff --git a/server/irc/connection.js b/server/irc/connection.js index 5cf64a4..738a72e 100644 --- a/server/irc/connection.js +++ b/server/irc/connection.js @@ -188,6 +188,11 @@ IrcConnection.prototype.dispose = function () { }); this.irc_users = null; this.irc_channels = null; + this.irc_users = undefined; + this.irc_channels = undefined; + + this.server.dispose(); + this.server = undefined; EventBinder.unbindIrcEvents('', this.irc_events, this); diff --git a/server/irc/server.js b/server/irc/server.js index 2a431e6..2478e20 100755 --- a/server/irc/server.js +++ b/server/irc/server.js @@ -19,7 +19,8 @@ var IrcServer = function (irc_connection, host, port) { motd_start: onMotdStart, motd: onMotd, motd_end: onMotdEnd, - error: onError, + error: onError_, + password_mismatch: onPasswordMismatch, channel_redirect: onChannelRedirect, no_such_nick: onNoSuchNick, cannot_send_to_channel: onCannotSendToChan, @@ -33,7 +34,7 @@ var IrcServer = function (irc_connection, host, port) { chanop_privs_needed: onChanopPrivsNeeded, nickname_in_use: onNicknameInUse }; - EventBinder.bindIrcEvents('server:' + this.host, this.irc_events, this, irc_connection); + EventBinder.bindIrcEvents('server:' + this.host, this.irc_events, this, this.irc_connection); }; @@ -43,7 +44,7 @@ module.exports = IrcServer; IrcServer.prototype.dispose = function (){ - EventBinder.unbindIrcEvents('server:' + this.host, this.irc_events); + EventBinder.unbindIrcEvents('server:' + this.host, this.irc_events, this.irc_connection); this.irc_connection = undefined; }; @@ -117,13 +118,19 @@ function onMotdEnd(event) { }); }; -function onError(event) { +function onError_(event) { this.irc_connection.clientEvent('irc_error', { error: 'error', reason: event.reason }); }; +function onPasswordMismatch(event) { + this.irc_connection.clientEvent('irc_error', { + error: 'password_mismatch' + }); +} + function onChannelRedirect(event) { this.irc_connection.clientEvent('channel_redirect', { from: event.from, -- 2.25.1