From f701d5ba20597f6f9bb1f157a5118f2550caca91 Mon Sep 17 00:00:00 2001 From: Darren Date: Mon, 20 May 2013 13:50:13 +0100 Subject: [PATCH] AWAY output in WHOIS --- client/assets/dev/model_network.js | 2 ++ server/irc/commands.js | 7 +++++++ server/irc/user.js | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/client/assets/dev/model_network.js b/client/assets/dev/model_network.js index c21f5e8..3c05644 100644 --- a/client/assets/dev/model_network.js +++ b/client/assets/dev/model_network.js @@ -560,6 +560,8 @@ logon_date = formatDate(logon_date); panel.addMsg(event.nick, 'idle for ' + idle_time + ', signed on ' + logon_date, 'whois'); + } else if (event.away_reason) { + panel.addMsg(event.nick, 'Away: ' + event.away_reason, 'whois'); } else { panel.addMsg(event.nick, 'idle for ' + idle_time, 'whois'); } diff --git a/server/irc/commands.js b/server/irc/commands.js index 71b8482..d311f0e 100644 --- a/server/irc/commands.js +++ b/server/irc/commands.js @@ -14,6 +14,7 @@ var irc_numerics = { RPL_LUSERME: '255', RPL_LOCALUSERS: '265', RPL_GLOBALUSERS: '266', + RPL_AWAY: '301', RPL_WHOISREGNICK: '307', RPL_WHOISUSER: '311', RPL_WHOISSERVER: '312', @@ -136,6 +137,12 @@ var listeners = { msg: command.trailing }); }, + 'RPL_AWAY': function (command) { + this.irc_connection.emit('user ' + command.params[1] + ' whoisaway', { + nick: command.params[1], + reason: command.trailing + }); + }, 'RPL_WHOISUSER': function (command) { this.irc_connection.emit('user ' + command.params[1] + ' whoisuser', { nick: command.params[1], diff --git a/server/irc/user.js b/server/irc/user.js index 69dc0a3..63c10f5 100755 --- a/server/irc/user.js +++ b/server/irc/user.js @@ -10,6 +10,7 @@ var IrcUser = function (irc_connection, nick) { away: onAway, quit: onQuit, whoisuser: onWhoisUser, + whoisaway: onWhoisAway, whoisoperator: onWhoisOperator, whoischannels: onWhoisChannels, whoismodes: onWhoisModes, @@ -75,6 +76,14 @@ function onWhoisUser(event) { }); }; +function onWhoisAway(event) { + this.irc_connection.clientEvent('whois', { + nick: event.nick, + away_reason: event.reason, + end: false + }); +}; + function onWhoisServer(event) { this.irc_connection.clientEvent('whois', { nick: event.nick, -- 2.25.1