mirror of
https://github.com/thelounge/thelounge
synced 2024-11-23 04:23:13 +00:00
commit
b986025e1a
2 changed files with 33 additions and 15 deletions
|
@ -1,4 +1,8 @@
|
|||
<p>{{> ../user_name nick=whois.nick}}</p>
|
||||
<p>
|
||||
{{> ../user_name nick=whois.nick}}
|
||||
{{#if whois.whowas}} is offline, last information:{{/if}}
|
||||
</p>
|
||||
|
||||
<dl class="whois">
|
||||
{{#if whois.account}}
|
||||
<dt>Logged in as:</dt>
|
||||
|
|
|
@ -5,10 +5,23 @@ const Msg = require("../../models/msg");
|
|||
|
||||
module.exports = function(irc, network) {
|
||||
const client = this;
|
||||
irc.on("whois", function(data) {
|
||||
|
||||
irc.on("whois", handleWhois);
|
||||
|
||||
irc.on("whowas", (data) => {
|
||||
data.whowas = true;
|
||||
|
||||
handleWhois(data);
|
||||
});
|
||||
|
||||
function handleWhois(data) {
|
||||
let chan = network.getChannel(data.nick);
|
||||
|
||||
if (typeof chan === "undefined") {
|
||||
// Do not create new windows for errors as they may contain illegal characters
|
||||
if (data.error) {
|
||||
chan = network.channels[0];
|
||||
} else {
|
||||
chan = client.createChannel({
|
||||
type: Chan.Type.QUERY,
|
||||
name: data.nick,
|
||||
|
@ -23,6 +36,7 @@ module.exports = function(irc, network) {
|
|||
chan.loadMessages(client, network);
|
||||
client.save();
|
||||
}
|
||||
}
|
||||
|
||||
let msg;
|
||||
|
||||
|
@ -43,5 +57,5 @@ module.exports = function(irc, network) {
|
|||
}
|
||||
|
||||
chan.pushMessage(client, msg);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue