Don't kick the kicker out of the rooms
authorMal Curtis <mal@sitepoint.com>
Sun, 21 Apr 2013 23:03:49 +0000 (11:03 +1200)
committerMal Curtis <mal@sitepoint.com>
Sun, 21 Apr 2013 23:11:56 +0000 (11:11 +1200)
server/irc/connection.js

index c392cac91da2ba51686693dedb3e324703629663..94b857e52524a9fbce46e8cb8a422dcc1bcee7f3 100644 (file)
@@ -109,7 +109,7 @@ IrcConnection.prototype.applyIrcEvents = function () {
         'user:*:nick':       onUserNick,
         'channel:*:part':    onUserParts,
         'channel:*:quit':    onUserParts,
-        'channel:*:kick':    onUserParts
+        'channel:*:kick':    onUserKick
     };
 
     EventBinder.bindIrcEvents('', this.irc_events, this, this);
@@ -314,6 +314,18 @@ function onUserParts(event) {
     }
 }
 
+function onUserKick(event){
+    // Only deal with ourselves being kicked from a channel
+    if (event.kicked !== this.nick)
+        return;
+
+    if (this.irc_channels[event.channel]) {
+        this.irc_channels[event.channel].dispose();
+        delete this.irc_channels[event.channel];
+    }
+
+}
+