Merge pull request #2576 from thelounge/xpaw/query-away-notify
Also send away notices to query windows
This commit is contained in:
commit
10642b8f5a
@ -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 || "",
|
||||
|
Loading…
Reference in New Issue
Block a user