From 35fe7e9426cadf893e5f05fe27a0d665bfe11d28 Mon Sep 17 00:00:00 2001 From: Sankha Narayan Guria Date: Tue, 18 Jun 2013 13:15:09 +0530 Subject: [PATCH] Fix deletion of array elements --- lib/irc.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/irc.js b/lib/irc.js index 79e96007..1eb6b39f 100644 --- a/lib/irc.js +++ b/lib/irc.js @@ -277,7 +277,7 @@ function Client(server, nick, opt) { var channel = self.chans[channame]; if ( 'string' == typeof channel.users[message.nick] ) { channel.users[message.args[0]] = channel.users[message.nick]; - delete channel.users[message.nick]; + channel.users.splice(message.nick, 1); channels.push(channame); } } @@ -426,11 +426,11 @@ function Client(server, nick, opt) { } if ( self.nick == message.nick ) { var channel = self.chanData(message.args[0]); - delete self.chans[channel.key]; + self.chans.splice(channel.key, 1); } else { var channel = self.chanData(message.args[0]); - delete channel.users[message.nick]; + channel.users.splice(message.nick, 1); } break; case "KICK": @@ -443,11 +443,11 @@ function Client(server, nick, opt) { if ( self.nick == message.args[1] ) { var channel = self.chanData(message.args[0]); - delete self.chans[channel.key]; + self.chans.splice(channel.key, 1); } else { var channel = self.chanData(message.args[0]); - delete channel.users[message.args[1]]; + channel.users.splice(message.args[1], 1); } break; case "KILL": @@ -457,7 +457,7 @@ function Client(server, nick, opt) { if ( self.chans[channel].users[nick]) channels.push(channel); - delete self.chans[channel].users[nick]; + self.chans[channel].users.splice(nick, 1); } self.emit('kill', nick, message.args[1], channels, message); break; @@ -503,7 +503,7 @@ function Client(server, nick, opt) { for ( var channame in self.chans ) { var channel = self.chans[channame]; if ( 'string' == typeof channel.users[message.nick] ) { - delete channel.users[message.nick]; + channel.users.splice(message.nick, 1); channels.push(channame); } } @@ -809,7 +809,7 @@ Client.prototype._clearWhoisData = function(nick) { // {{{ // Ensure that at least the nick exists before trying to return this._addWhoisData(nick, 'nick', nick); var data = this._whoisData[nick]; - delete this._whoisData[nick]; + this._whoisData.splice(nick, 1); return data; } // }}} Client.prototype._handleCTCP = function(from, to, text, type) {