ERR_PASSWORDMISMATCH; IrcServer disposing
[KiwiIRC.git] / server / irc / server.js
index 2a431e6796421267713131df622747372b2d4163..2478e202a85b1b4c29d54e07409f4f66c7aca152 100755 (executable)
@@ -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,