From 19bd1b19dcaa570863880a538f70783c5461ef97 Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Sun, 4 Nov 2012 00:11:37 +0000 Subject: [PATCH] Implements away-notify Issue #116 --- client/assets/dev/model_application.js | 11 +++++++++++ server/irc/commands.js | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/assets/dev/model_application.js b/client/assets/dev/model_application.js index 916710d..6fd5632 100644 --- a/client/assets/dev/model_application.js +++ b/client/assets/dev/model_application.js @@ -570,6 +570,17 @@ kiwi.model.Application = function () { } }); + gw.on('onaway', function (event) { + $.each(that.panels.models, function (index, panel) { + if (!panel.isChannel()) return; + + member = panel.get('members').getByNick(event.nick); + if (member) { + member.set('away', !(!event.trailing)); + } + }); + }); + gw.on('onlist_start', function (data) { if (kiwi.app.channel_list) { diff --git a/server/irc/commands.js b/server/irc/commands.js index 5f0b8c7..dd7fbe8 100644 --- a/server/irc/commands.js +++ b/server/irc/commands.js @@ -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; -- 2.25.1