/ctcp command implimented into the client #177
authorDarren <darren@Darrens-MacBook-Pro.local>
Mon, 4 Mar 2013 21:56:22 +0000 (21:56 +0000)
committerDarren <darren@Darrens-MacBook-Pro.local>
Mon, 4 Mar 2013 21:56:22 +0000 (21:56 +0000)
client/assets/dev/model_application.js

index 50a3b15585d4d93bbb3789516a5a835d27bc65df..2c4b2d33c1eed8d85240950e05099b6751ae4025 100644 (file)
@@ -457,6 +457,11 @@ _kiwi.model.Application = function () {
             });\r
 \r
 \r
+            gw.on('onctcp_response', function (event) {\r
+                that.panels.server.addMsg('[' + event.nick + ']', 'CTCP ' + event.msg);\r
+            });\r
+\r
+\r
             gw.on('onnotice', function (event) {\r
                 var panel;\r
 \r
@@ -833,6 +838,8 @@ _kiwi.model.Application = function () {
 \r
             controlbox.on('command_clear', clearCommand);\r
 \r
+            controlbox.on('command_ctcp', ctcpCommand);\r
+\r
 \r
             controlbox.on('command_css', function (ev) {\r
                 var queryString = '?reload=' + new Date().getTime();\r
@@ -1044,6 +1051,21 @@ _kiwi.model.Application = function () {
             }\r
         }\r
 \r
+        function ctcpCommand(ev) {\r
+            var target, type;\r
+\r
+            // Make sure we have a target and a ctcp type (eg. version, time)\r
+            if (ev.params.length < 2) return;\r
+\r
+            target = ev.params[0];\r
+            ev.params.shift();\r
+\r
+            type = ev.params[0];\r
+            ev.params.shift();\r
+\r
+            _kiwi.gateway.ctcp(true, type, target, ev.params.join(' '));\r
+        }\r
+\r
         function settingsCommand (ev) {\r
             var settings = _kiwi.model.Applet.loadOnce('kiwi_settings');\r
             settings.view.show();\r