diff --git a/client/views/actions/whois.tpl b/client/views/actions/whois.tpl index 0e17a02c..d890efcf 100644 --- a/client/views/actions/whois.tpl +++ b/client/views/actions/whois.tpl @@ -1,26 +1,35 @@
- {{whois.nickname}} - ({{whois.username}}@{{whois.hostname}}): + {{whois.nick}} + ({{whois.user}}@{{whois.host}}): {{whois.realname}}
+{{#if whois.account}} +
+ {{whois.nick}} + is logged in as {{whois.account}} +
+{{/if}} {{#if whois.channels}}
- {{whois.nickname}} - is on the following channels: - {{#each whois.channels}} - {{{parse this}}} - {{/each}} + {{whois.nick}} + is on the following channels: {{{parse whois.channels}}}
{{/if}} {{#if whois.server}}
- {{whois.nickname}} - is connected to {{whois.server}} + {{whois.nick}} + is connected to {{whois.server}} ({{whois.server_info}}) +
+{{/if}} +{{#if whois.secure}} +
+ {{whois.nick}} + is using a secure connection
{{/if}} {{#if whois.away}}
- {{whois.nickname}} + {{whois.nick}} is away ({{whois.away}})
{{/if}} diff --git a/src/plugins/irc-events/whois.js b/src/plugins/irc-events/whois.js index d4d8374b..d10c7426 100644 --- a/src/plugins/irc-events/whois.js +++ b/src/plugins/irc-events/whois.js @@ -4,15 +4,12 @@ var Msg = require("../../models/msg"); module.exports = function(irc, network) { var client = this; - irc.on("whois", function(err, data) { - if (data === null) { - return; - } - var chan = _.find(network.channels, {name: data.nickname}); + irc.on("whois", function(data) { + var chan = _.find(network.channels, {name: data.nick}); if (typeof chan === "undefined") { chan = new Chan({ type: Chan.Type.QUERY, - name: data.nickname + name: data.nick }); network.channels.push(chan); client.emit("join", { @@ -20,10 +17,20 @@ module.exports = function(irc, network) { chan: chan }); } - var msg = new Msg({ - type: Msg.Type.WHOIS, - whois: data - }); + + var msg; + if (data.error) { + msg = new Msg({ + type: Msg.Type.ERROR, + text: "No such nick: " + data.nick + }); + } else { + msg = new Msg({ + type: Msg.Type.WHOIS, + whois: data + }); + } + chan.messages.push(msg); client.emit("msg", { chan: chan.id,