CTCP CLIENTINFO, SOURCE, TIME
authorDarren <darren@darrenwhitlen.com>
Fri, 30 Nov 2012 20:33:43 +0000 (20:33 +0000)
committerDarren <darren@darrenwhitlen.com>
Fri, 30 Nov 2012 20:33:43 +0000 (20:33 +0000)
client/assets/dev/model_application.js
server/irc/commands.js

index 156b0f8db50d37dc853c9314e1ac817acf782772..6610a460aa88a6de1bee2d2cde59f8d57b49e15b 100644 (file)
@@ -416,6 +416,14 @@ _kiwi.model.Application = function () {
             });\r
 \r
 \r
+            gw.on('onctcp_request', function (event) {\r
+                // Reply to a TIME ctcp\r
+                if (event.msg.toUpperCase() === 'TIME') {\r
+                    gw.ctcp(true, event.type, event.nick, (new Date()).toString());\r
+                }\r
+            });\r
+\r
+\r
             gw.on('onnotice', function (event) {\r
                 var panel;\r
 \r
index 36e8e63f826018f4926f7e1d1480105e1090eb97..ca710ad18364cd9775f4c5a8b31b5f078eb04c96 100644 (file)
@@ -322,8 +322,20 @@ var listeners = {
                 this.client.sendIrcCommand('kiwi', {server: this.con_num, namespace: namespace, data: tmp.substr(namespace.length + 1)});
             } else if (command.trailing.substr(1, 7) === 'VERSION') {
                 this.irc_connection.write('NOTICE ' + command.nick + ' :' + String.fromCharCode(1) + 'VERSION KiwiIRC' + String.fromCharCode(1));
+            } else if (command.trailing.substr(1, 6) === 'SOURCE') {
+                this.irc_connection.write('NOTICE ' + command.nick + ' :' + String.fromCharCode(1) + 'SOURCE http://www.kiwiirc.com/' + String.fromCharCode(1));
+            } else if (command.trailing.substr(1, 10) === 'CLIENTINFO') {
+                this.irc_connection.write('NOTICE ' + command.nick + ' :' + String.fromCharCode(1) + 'CLIENTINFO SOURCE VERSION TIME' + String.fromCharCode(1));
             } else {
-                this.client.sendIrcCommand('ctcp_request', {server: this.con_num, nick: command.nick, ident: command.ident, hostname: command.hostname, channel: command.params[0], msg: command.trailing.substr(1, command.trailing.length - 2)});
+                this.client.sendIrcCommand('ctcp_request', {
+                    server: this.con_num,
+                    nick: command.nick,
+                    ident: command.ident,
+                    hostname: command.hostname,
+                    target: command.params[0],
+                    type: (command.trailing.substr(1, command.trailing.length - 2).split(' ') || [null])[0],
+                    msg: command.trailing.substr(1, command.trailing.length - 2)
+                });
             }
         } else {
             //{nick: msg.nick, ident: msg.ident, hostname: msg.hostname, channel: msg.params.trim(), msg: msg.trailing}