From: Darren Date: Sat, 10 May 2014 11:28:36 +0000 (+0100) Subject: Switching switching irc events `channel` property to `target` where ambiguous X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c05762040a325035f8a6d5452f5c33ffcf6cb199;p=KiwiIRC.git Switching switching irc events `channel` property to `target` where ambiguous --- diff --git a/client/src/models/gateway.js b/client/src/models/gateway.js index 8113554..f72e940 100644 --- a/client/src/models/gateway.js +++ b/client/src/models/gateway.js @@ -34,9 +34,9 @@ _kiwi.model.Gateway = function () { this.on('onmsg', function (event) { var source, connection = _kiwi.app.connections.getByConnectionId(event.server), - is_pm = (event.channel.toLowerCase() == connection.get('nick').toLowerCase()); + is_pm = (event.target.toLowerCase() == connection.get('nick').toLowerCase()); - source = is_pm ? event.nick : event.channel; + source = is_pm ? event.nick : event.target; that.trigger('message:' + source, event); that.trigger('message', event); @@ -60,9 +60,9 @@ _kiwi.model.Gateway = function () { this.on('onaction', function (event) { var source, connection = _kiwi.app.connections.getByConnectionId(event.server), - is_pm = (event.channel.toLowerCase() == connection.get('nick').toLowerCase()); + is_pm = (event.target.toLowerCase() == connection.get('nick').toLowerCase()); - source = is_pm ? event.nick : event.channel; + source = is_pm ? event.nick : event.target; that.trigger('action:' + source, event); diff --git a/client/src/models/network.js b/client/src/models/network.js index ae050a1..05d5b33 100644 --- a/client/src/models/network.js +++ b/client/src/models/network.js @@ -400,7 +400,7 @@ function onMsg(event) { var panel, - is_pm = (event.channel.toLowerCase() == this.get('nick').toLowerCase()); + is_pm = (event.target.toLowerCase() == this.get('nick').toLowerCase()); // An ignored user? don't do anything with it if (this.isNickIgnored(event.nick)) { @@ -418,7 +418,7 @@ } else { // If a panel isn't found for this channel, reroute to the // server panel - panel = this.panels.getByName(event.channel); + panel = this.panels.getByName(event.target); if (!panel) { panel = this.panels.server; } @@ -517,7 +517,7 @@ function onAction(event) { var panel, - is_pm = (event.channel.toLowerCase() == this.get('nick').toLowerCase()); + is_pm = (event.target.toLowerCase() == this.get('nick').toLowerCase()); // An ignored user? don't do anything with it if (this.isNickIgnored(event.nick)) { @@ -535,7 +535,7 @@ } else { // If a panel isn't found for this channel, reroute to the // server panel - panel = this.panels.getByName(event.channel); + panel = this.panels.getByName(event.target); if (!panel) { panel = this.panels.server; } diff --git a/server/irc/channel.js b/server/irc/channel.js index 8c2c4a6..f2a93d3 100644 --- a/server/irc/channel.js +++ b/server/irc/channel.js @@ -141,7 +141,7 @@ function onMsg(event) { nick: event.nick, ident: event.ident, hostname: event.hostname, - channel: that.name, + target: that.name, msg: event.msg, time: event.time }); @@ -162,7 +162,7 @@ function onAction(event) { nick: event.nick, ident: event.ident, hostname: event.hostname, - channel: event.channel, + target: event.target, msg: event.msg, time: event.time }); diff --git a/server/irc/commands.js b/server/irc/commands.js index f7f1d84..a0b3259 100644 --- a/server/irc/commands.js +++ b/server/irc/commands.js @@ -525,7 +525,7 @@ handlers = { nick: command.nick, ident: command.ident, hostname: command.hostname, - channel: command.params[0], + target: command.params[0], msg: msg.substring(1, msg.length - 1), time: time }); @@ -619,7 +619,7 @@ handlers = { nick: command.nick, ident: command.ident, hostname: command.hostname, - channel: command.params[0], + target: command.params[0], msg: msg.substring(8, msg.length - 1), time: time }); @@ -643,8 +643,11 @@ handlers = { this.irc_connection.write('NOTICE ' + command.nick + ' :' + String.fromCharCode(1) + 'CLIENTINFO SOURCE VERSION TIME' + String.fromCharCode(1)); } else { - namespace = (command.params[0].toLowerCase() === this.irc_connection.nick.toLowerCase()) ? 'user' : 'channel'; - this.irc_connection.emit(namespace + ' ' + command.nick + ' ctcp_request', { + namespace = (command.params[0].toLowerCase() === this.irc_connection.nick.toLowerCase()) ? + 'user ' + command.nick : + 'channel ' + command.params[0]; + + this.irc_connection.emit(namespace + ' ctcp_request', { nick: command.nick, ident: command.ident, hostname: command.hostname, @@ -661,7 +664,7 @@ handlers = { nick: command.nick, ident: command.ident, hostname: command.hostname, - channel: command.params[0], + target: command.params[0], msg: msg, time: time }); diff --git a/server/irc/user.js b/server/irc/user.js index 69df179..59450be 100755 --- a/server/irc/user.js +++ b/server/irc/user.js @@ -243,7 +243,7 @@ function onCtcpResponse(event) { nick: event.nick, ident: event.ident, hostname: event.hostname, - channel: event.channel, + target: event.target, msg: event.msg, time: event.time }); @@ -261,7 +261,7 @@ function onPrivmsg(event) { nick: event.nick, ident: event.ident, hostname: event.hostname, - channel: event.channel, + target: event.target, msg: event.msg, time: event.time }); @@ -280,7 +280,7 @@ function onAction(event) { nick: event.nick, ident: event.ident, hostname: event.hostname, - channel: event.channel, + target: event.target, msg: event.msg, time: event.time });