Make whois work
This commit is contained in:
parent
28ae544b2a
commit
b6993f6e37
@ -1,26 +1,35 @@
|
||||
<div>
|
||||
<a href="#" class="user" data-name="{{whois.nickname}}">{{whois.nickname}}</a>
|
||||
<i class="hostmask">({{whois.username}}@{{whois.hostname}})</i>:
|
||||
<a href="#" class="user" data-name="{{whois.nick}}">{{whois.nick}}</a>
|
||||
<i class="hostmask">({{whois.user}}@{{whois.host}})</i>:
|
||||
<b>{{whois.realname}}</b>
|
||||
</div>
|
||||
{{#if whois.account}}
|
||||
<div>
|
||||
<a href="#" class="user" data-name="{{whois.nickname}}">{{whois.nick}}</a>
|
||||
is logged in as <b>{{whois.account}}</b>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if whois.channels}}
|
||||
<div>
|
||||
<a href="#" class="user" data-name="{{whois.nickname}}">{{whois.nickname}}</a>
|
||||
is on the following channels:
|
||||
{{#each whois.channels}}
|
||||
{{{parse this}}}
|
||||
{{/each}}
|
||||
<a href="#" class="user" data-name="{{whois.nickname}}">{{whois.nick}}</a>
|
||||
is on the following channels: {{{parse whois.channels}}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if whois.server}}
|
||||
<div>
|
||||
<a href="#" class="user" data-name="{{whois.nickname}}">{{whois.nickname}}</a>
|
||||
is connected to {{whois.server}}
|
||||
<a href="#" class="user" data-name="{{whois.nickname}}">{{whois.nick}}</a>
|
||||
is connected to {{whois.server}} <i>({{whois.server_info}})</i>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if whois.secure}}
|
||||
<div>
|
||||
<a href="#" class="user" data-name="{{whois.nickname}}">{{whois.nick}}</a>
|
||||
is using a secure connection
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if whois.away}}
|
||||
<div>
|
||||
<a href="#" class="user" data-name="{{whois.nickname}}">{{whois.nickname}}</a>
|
||||
<a href="#" class="user" data-name="{{whois.nickname}}">{{whois.nick}}</a>
|
||||
is away <i>({{whois.away}})</i>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user