From 62e2cbe66b30ddad7e4fb46a12b73a161df17bb2 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Wed, 20 Jun 2018 19:45:27 +0300 Subject: [PATCH] Also send away notices to query windows --- src/plugins/irc-events/away.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/plugins/irc-events/away.js b/src/plugins/irc-events/away.js index 25895632..1a3dabce 100644 --- a/src/plugins/irc-events/away.js +++ b/src/plugins/irc-events/away.js @@ -1,5 +1,6 @@ "use strict"; +const Chan = require("../../models/chan"); const Msg = require("../../models/msg"); module.exports = function(irc, network) { @@ -25,9 +26,28 @@ module.exports = function(irc, network) { } 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; }