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"; "use strict";
const Chan = require("../../models/chan");
const Msg = require("../../models/msg"); const Msg = require("../../models/msg");
module.exports = function(irc, network) { module.exports = function(irc, network) {
@ -25,9 +26,28 @@ module.exports = function(irc, network) {
} }
network.channels.forEach((chan) => { network.channels.forEach((chan) => {
const user = chan.findUser(data.nick); let user;
if (!user || user.away === away) { 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; return;
} }