MAking Wallops a specific message type
authorCory Chaplin <cory.chaplin@laposte.net>
Thu, 15 May 2014 21:06:39 +0000 (23:06 +0200)
committerCory Chaplin <cory.chaplin@laposte.net>
Thu, 15 May 2014 21:06:39 +0000 (23:06 +0200)
client/assets/text_themes/default.json
client/src/app.js
client/src/models/gateway.js
client/src/models/network.js
server/irc/commands.js
server/irc/user.js

index 9f39da913dd13cad0b3ae7e620b771e9fdcdab0a..0f6f658abedb08f3e51e3480a200df6fefca673f 100644 (file)
@@ -51,5 +51,6 @@
     "rejoin": "%text",
     "set_setting": "ⓘ %text",
     "list_aliases": "ⓘ %text",
-    "ignored_pattern": "ⓘ %text"
+    "ignored_pattern": "ⓘ %text",
+    "wallops": "[WALLOPS] %text"
 }
\ No newline at end of file
index d65887a82453f9e4aa928941e3f6d110fcdba509..595049ef64d6155bf34b11138b26a1ee40dea791 100644 (file)
@@ -67,7 +67,7 @@ _kiwi.global = {
                 part: 'part', join: 'join', action: 'action', ctcp: 'ctcp',\r
                 ctcpRequest: 'ctcpRequest', ctcpResponse: 'ctcpResponse',\r
                 notice: 'notice', msg: 'privmsg', changeNick: 'changeNick',\r
-                channelInfo: 'channelInfo', mode: 'mode'\r
+                channelInfo: 'channelInfo', mode: 'mode', wallops: 'wallops'\r
             };\r
 \r
             // Proxy each gateway method\r
index 45106a7127c1b719453e7ef475331e2792691b0b..563e4b53286dfb84d949838ce15ced9827dacef7 100644 (file)
@@ -295,6 +295,7 @@ _kiwi.model.Gateway = function () {
         this.ctcp(connection_id, false, type, target, params, callback);\r
     };\r
 \r
+\r
     /**\r
     *   @param  {String}    target      The target of the message (e.g. a channel or nick)\r
     *   @param  {String}    msg         The message to send\r
@@ -441,6 +442,22 @@ _kiwi.model.Gateway = function () {
         this.rpcCall('irc.encoding', connection_id, args, callback);\r
     };\r
 \r
+    /**\r
+    *   Sends a Wallops message\r
+    *   @param  {String}    target      The target of the message\r
+    *   @param  {String}    msg         The message to send\r
+    *   @param  {Function}  callback    A callback function\r
+    */\r
+    this.wallops = function (connection_id, target, msg, callback) {\r
+        console.log(target);\r
+        var args = {\r
+            target: target,\r
+            msg: msg\r
+        };\r
+\r
+        this.rpcCall('irc.wallops', connection_id, args, callback);\r
+    };\r
+\r
 \r
     return new (Backbone.Model.extend(this))(arguments);\r
 };\r
index cca4716417acf85e3d0f4f6f5272e9a754eb7137..3247d82725e3986d8691198214711141414362f6 100644 (file)
             this.gateway.on('irc_error', onIrcError, this);
             this.gateway.on('unknown_command', onUnknownCommand, this);
             this.gateway.on('channel_info', onChannelInfo, this);
+            this.gateway.on('wallops', onWallops, this);
         },
 
 
 
         this.panels.server.addMsg('', styleText('unknown_command', {text: '[' + event.command + '] ' + display_params.join(', ', '')}));
     }
+
+
+    function onWallops(event) {
+        var panel, active_panel;
+
+        panel = this.panels.server;
+
+        panel.addMsg('[' + (event.nick||'') + ']', styleText('wallops', {text: event.msg}), 'wallops', {time: event.time});
+
+        // Show wallops to the active panel if it's channel or query window
+        active_panel = _kiwi.app.panels().active;
+
+        if (active_panel !== panel) {
+            if (active_panel.isChannel() || active_panel.isQuery())
+            _kiwi.app.panels().active.addMsg('[' + (event.nick||'') + ']', styleText('wallops', {text: event.msg}), 'wallops', {time: event.time});
+        }
+    }
+
 }
 
 )();
index 50b85c9e7305fba0a1000038d22c21d9744e0e74..305e04e34abecdb8d1a51739486e3362357cc6f7 100644 (file)
@@ -1417,9 +1417,9 @@ handlers = {
     },
 
     RPL_WALLOPS: function (command) {
-        this.irc_connection.emit('user ' + this.irc_connection.nick + ' notice', {
+        this.irc_connection.emit('user ' + this.irc_connection.nick + ' wallops', {
             from_server: false,
-            nick: 'WALLOPS: ' + command.nick,
+            nick: command.nick,
             ident: command.ident,
             hostname: command.hostname,
             target: this.irc_connection.nick,
index a80f8bfca5d2b3c1303319019b5d8a07085d48c3..d8083bcd74010a6e033877f1e2e6555af4ba74b7 100755 (executable)
@@ -32,7 +32,8 @@ var IrcUser = function (irc_connection, nick) {
         privmsg:        onPrivmsg,\r
         action:         onAction,\r
         ctcp_request:   onCtcpRequest,\r
-        mode:           onMode\r
+        mode:           onMode,\r
+        wallops:        onWallops\r
     };\r
     EventBinder.bindIrcEvents('user ' + this.nick, this.irc_events, this, irc_connection);\r
 };\r
@@ -316,3 +317,14 @@ function onMode(event) {
         time: event.time\r
     });\r
 }\r
+\r
+function onWallops(event) {\r
+    this.irc_connection.clientEvent('wallops', {\r
+        nick: event.nick,\r
+        ident: event.ident,\r
+        hostname: event.hostname,\r
+        target: event.target,\r
+        msg: event.msg,\r
+        time: event.time\r
+    });\r
+}\r