Switching switching irc events `channel` property to `target` where ambiguous
authorDarren <darren@darrenwhitlen.com>
Sat, 10 May 2014 11:28:36 +0000 (12:28 +0100)
committerDarren <darren@darrenwhitlen.com>
Sat, 10 May 2014 11:28:36 +0000 (12:28 +0100)
client/src/models/gateway.js
client/src/models/network.js
server/irc/channel.js
server/irc/commands.js
server/irc/user.js

index 8113554551ab40c87dda61cc84f09e7abe10f5f6..f72e9409935daa0e2b7733d3a8f6b3ff1eb30f40 100644 (file)
@@ -34,9 +34,9 @@ _kiwi.model.Gateway = function () {
         this.on('onmsg', function (event) {\r
             var source,\r
                 connection = _kiwi.app.connections.getByConnectionId(event.server),\r
-                is_pm = (event.channel.toLowerCase() == connection.get('nick').toLowerCase());\r
+                is_pm = (event.target.toLowerCase() == connection.get('nick').toLowerCase());\r
 \r
-            source = is_pm ? event.nick : event.channel;\r
+            source = is_pm ? event.nick : event.target;\r
 \r
             that.trigger('message:' + source, event);\r
             that.trigger('message', event);\r
@@ -60,9 +60,9 @@ _kiwi.model.Gateway = function () {
         this.on('onaction', function (event) {\r
             var source,\r
                 connection = _kiwi.app.connections.getByConnectionId(event.server),\r
-                is_pm = (event.channel.toLowerCase() == connection.get('nick').toLowerCase());\r
+                is_pm = (event.target.toLowerCase() == connection.get('nick').toLowerCase());\r
 \r
-            source = is_pm ? event.nick : event.channel;\r
+            source = is_pm ? event.nick : event.target;\r
 \r
             that.trigger('action:' + source, event);\r
 \r
index ae050a1cd89ca99bb7c274590bd9d075ab4ddaf0..05d5b334b085102f78a9497b86fc9cd052ff1cb1 100644 (file)
 
     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)) {
         } 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;
             }
 
     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)) {
         } 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;
             }
index 8c2c4a6a0747cde171e98e25277fc99bd2e00632..f2a93d36a6f5992c4094c8a3f912318d54a8f1eb 100644 (file)
@@ -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
         });
index f7f1d84717d87ac3384a11d541599367bc6e2aef..a0b3259805ac09ed02f3a366da9e6c2097f63029 100644 (file)
@@ -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
             });
index 69df179862c300e40503ae1a0ea6a65b5bc2af27..59450be42d6cf870351bb9ade0ebf5e6cb2c959c 100755 (executable)
@@ -243,7 +243,7 @@ function onCtcpResponse(event) {
         nick: event.nick,\r
         ident: event.ident,\r
         hostname: event.hostname,\r
-        channel: event.channel,\r
+        target: event.target,\r
         msg: event.msg,\r
         time: event.time\r
     });\r
@@ -261,7 +261,7 @@ function onPrivmsg(event) {
             nick: event.nick,\r
             ident: event.ident,\r
             hostname: event.hostname,\r
-            channel: event.channel,\r
+            target: event.target,\r
             msg: event.msg,\r
             time: event.time\r
         });\r
@@ -280,7 +280,7 @@ function onAction(event) {
             nick: event.nick,\r
             ident: event.ident,\r
             hostname: event.hostname,\r
-            channel: event.channel,\r
+            target: event.target,\r
             msg: event.msg,\r
             time: event.time\r
         });\r