Also send away notices to query windows

This commit is contained in:
Pavel Djundik 2018-06-20 19:45:27 +03:00
parent c95b09cbac
commit 62e2cbe66b

View File

@ -1,5 +1,6 @@
"use strict";
const Chan = require("../../models/chan");
const Msg = require("../../models/msg");
module.exports = function(irc, network) {
@ -25,12 +26,31 @@ module.exports = function(irc, network) {
}
network.channels.forEach((chan) => {
const user = chan.findUser(data.nick);
let user;
switch (chan.type) {
case Chan.Type.QUERY:
if (data.nick.toLowerCase() !== chan.name.toLowerCase()) {
return;
}
user = chan.getUser(data.nick);
break;
case Chan.Type.CHANNEL:
user = chan.findUser(data.nick);
if (!user || user.away === away) {
return;
}
break;
default:
return;
}
const msg = new Msg({
type: type,
text: away || "",