Channel case-sensitivity issues. Main cause of "Cannot call method 'clientEvent'...
[KiwiIRC.git] / server / irc / channel.js
index 926aedd2119065e793a13e81bc9053899f2fddf5..2226828a0372d1a49b44b3946af723867929330c 100644 (file)
@@ -4,7 +4,9 @@ var util        = require('util'),
 
 var IrcChannel = function(irc_connection, name) {
     this.irc_connection = irc_connection;
-    this.name = name;
+
+    // Lowercase the channel name so we don't run into case-sensitive issues
+    this.name = name.toLowerCase();
 
     this.members = [];
     this.ban_list_buffer = [];
@@ -84,18 +86,20 @@ function onPart(event) {
 
 
 function onKick(event) {
+    var that = this;
+
     global.modules.emit('irc channel kick', {
         channel: this,
         connection: this.irc_connection,
         irc_event: event
     })
     .done(function() {
-        this.irc_connection.clientEvent('kick', {
+        that.irc_connection.clientEvent('kick', {
             kicked: event.kicked,  // Nick of the kicked
             nick: event.nick, // Nick of the kicker
             ident: event.ident,
             hostname: event.hostname,
-            channel: this.name,
+            channel: that.name,
             message: event.message,
             time: event.time
         });