Merge pull request #2576 from thelounge/xpaw/query-away-notify

Also send away notices to query windows
This commit is contained in:
Jérémie Astori 2018-06-21 21:01:58 -04:00 committed by GitHub
commit 10642b8f5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 2 deletions

View File

@ -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;
}