From 7f96413bc981b0dc08b353cdf8c9f46437b94120 Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Sat, 6 Oct 2012 15:20:35 +0100 Subject: [PATCH] WHOIS fixes. Fixes bug #83 - Whois data: nick should be blank or of the person being whoised Fixes bug #84 - Whois: Idle time is not being shown --- client_backbone/dev/model_application.js | 10 ++++++++-- server/irc-commands.js | 18 +++++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/client_backbone/dev/model_application.js b/client_backbone/dev/model_application.js index d54d018..d1b8c2f 100755 --- a/client_backbone/dev/model_application.js +++ b/client_backbone/dev/model_application.js @@ -521,12 +521,18 @@ kiwi.model.Application = Backbone.Model.extend(new (function () { } panel = kiwi.app.panels.active; - if (event.msg) { + if (event.ident) { + panel.addMsg(event.nick, 'is ' + event.nick + '!' + event.ident + '@' + event.host + ' * ' + event.msg, 'whois'); + } else if (event.chans) { + panel.addMsg(event.nick, 'on ' + event.chans, 'whois'); + } else if (event.server) { + panel.addMsg(event.nick, 'using ' + event.server, 'whois'); + } else if (event.msg) { panel.addMsg(event.nick, event.msg, 'whois'); } else if (event.logon) { logon_date = new Date(); logon_date.setTime(event.logon * 1000); - logon_date = formateDate(logon_date); + logon_date = logon_date.toLocaleDateString() + ', ' + logon_date.getHours().toString() + ':' + logon_date.getMinutes().toString() + ':' + logon_date.getSeconds().toString(); panel.addMsg(event.nick, 'idle for ' + idle_time + ', signed on ' + logon_date, 'whois'); } else { diff --git a/server/irc-commands.js b/server/irc-commands.js index fb72fe7..bacca05 100755 --- a/server/irc-commands.js +++ b/server/irc-commands.js @@ -101,49 +101,53 @@ var listeners = { command.command = 'RPL_ENDOFWHOIS'; this.client.sendIRCCommand(command);*/ //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: true}); - this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: true}); + this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], msg: command.trailing, end: true}); }, 'RPL_WHOISUSER': function (command) { /*command.server = this.con_num; command.command = 'RPL_WHOISUSER'; this.client.sendIRCCommand(command);*/ //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false}); - this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: false}); + this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], ident: command.params[2], host: command.params[3], msg: command.trailing, end: false}); }, 'RPL_WHOISSERVER': function (command) { /*command.server = this.con_num; command.command = 'RPL_WHOISSERVER'; this.client.sendIRCCommand(command);*/ //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false}); - this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: false}); + this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], server: command.params[2], end: false}); }, 'RPL_WHOISOPERATOR': function (command) { /*command.server = this.con_num; command.command = 'RPL_WHOISOPERATOR'; this.client.sendIRCCommand(command);*/ //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false}); - this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: false}); + this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], msg: command.trailing, end: false}); }, 'RPL_WHOISCHANNELS': function (command) { /*command.server = this.con_num; command.command = 'RPL_WHOISCHANNELS'; this.client.sendIRCCommand(command);*/ //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false}); - this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: false}); + this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], chans: command.trailing, end: false}); }, 'RPL_WHOISMODES': function (command) { /*command.server = this.con_num; command.command = 'RPL_WHOISMODES'; this.client.sendIRCCommand(command);*/ //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false}); - this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: false}); + this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], msg: command.trailing, end: false}); }, 'RPL_WHOISIDLE': function (command) { /*command.server = this.con_num; command.command = 'RPL_WHOISIDLE'; this.client.sendIRCCommand(command);*/ //websocket.sendClientEvent('whois', {server: '', nick: msg.params.split(" ", 3)[1], "msg": msg.trailing, end: false}); - this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[0], msg: command.trailing, end: false}); + if (command.params[3]) { + this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], idle: command.params[2], logon: command.params[3], end: false}); + } else { + this.client.sendIRCCommand('whois', {server: this.con_num, nick: command.params[1], idle: command.params[2], end: false}); + } }, 'RPL_LISTSTART': function (command) { /*command.server = this.con_num; -- 2.25.1