Implements away-notify
authorJack Allnutt <m2ys4u@Gmail.com>
Sun, 4 Nov 2012 00:11:37 +0000 (00:11 +0000)
committerJack Allnutt <m2ys4u@Gmail.com>
Sun, 4 Nov 2012 00:11:37 +0000 (00:11 +0000)
Issue #116

client/assets/dev/model_application.js
server/irc/commands.js

index 916710def8a0392d7ad9b2f0a974fdaae0773950..6fd5632307d99fbf229307546982b003e72effca 100644 (file)
@@ -570,6 +570,17 @@ kiwi.model.Application = function () {
                 }\r
             });\r
 \r
+            gw.on('onaway', function (event) {\r
+                $.each(that.panels.models, function (index, panel) {\r
+                    if (!panel.isChannel()) return;\r
+\r
+                    member = panel.get('members').getByNick(event.nick);\r
+                    if (member) {\r
+                        member.set('away', !(!event.trailing));\r
+                    }\r
+                });\r
+            });
+\r
 \r
             gw.on('onlist_start', function (data) {\r
                 if (kiwi.app.channel_list) {\r
index 5f0b8c71e85b79921e59aaf37dec7177c2ce19d2..dd7fbe841e1f96e4bf007886ecf35f0f9eb6b9c6 100644 (file)
@@ -443,7 +443,7 @@ var listeners = {
                 // i.e. - for disable, ~ for requires ACK, = for sticky
                 var capabilities = command.trailing.replace(/[\-~=]/, '').split(' ');
                 var request;
-                var want = ['multi-prefix'];
+                var want = ['multi-prefix', 'away-notify'];
                 
                 if (this.irc_connection.password) {
                     want.push('sasl');
@@ -511,6 +511,9 @@ var listeners = {
                     this.irc_connection.register();
                 }
             },
+    'AWAY':                 function (command) {
+                this.client.sendIrcCommand('away', {server: this.con_num, nick: command.nick, msg: command.trailing});
+            },
     'RPL_SASLAUTHENTICATED':function (command) {
                 this.irc_connection.write('CAP END');
                 this.irc_connection.cap_negotation = false;