Always send notices that are not targeted at us into the server window
This commit is contained in:
parent
4a7fc0544e
commit
92cc130e2b
@ -7,6 +7,12 @@ module.exports = function(irc, network) {
|
|||||||
var config = Helper.getConfig();
|
var config = Helper.getConfig();
|
||||||
|
|
||||||
irc.on("notice", function(data) {
|
irc.on("notice", function(data) {
|
||||||
|
// Some servers send notices without any nickname
|
||||||
|
if (!data.nick) {
|
||||||
|
data.from_server = true;
|
||||||
|
data.nick = network.host;
|
||||||
|
}
|
||||||
|
|
||||||
data.type = Msg.Type.NOTICE;
|
data.type = Msg.Type.NOTICE;
|
||||||
handleMessage(data);
|
handleMessage(data);
|
||||||
});
|
});
|
||||||
@ -27,14 +33,20 @@ module.exports = function(irc, network) {
|
|||||||
chan = network.channels[0];
|
chan = network.channels[0];
|
||||||
} else {
|
} else {
|
||||||
var target = data.target;
|
var target = data.target;
|
||||||
|
var targetedAtUser = false;
|
||||||
|
|
||||||
// If the message is targeted at us, use sender as target instead
|
// If the message is targeted at us, use sender as target instead
|
||||||
if (target.toLowerCase() === irc.user.nick.toLowerCase()) {
|
if (target.toLowerCase() === irc.user.nick.toLowerCase()) {
|
||||||
|
targetedAtUser = true;
|
||||||
target = data.nick;
|
target = data.nick;
|
||||||
}
|
}
|
||||||
|
|
||||||
var chan = network.getChannel(target);
|
var chan = network.getChannel(target);
|
||||||
if (typeof chan === "undefined") {
|
if (typeof chan === "undefined") {
|
||||||
|
// Send notices that are not targeted at us into the server window
|
||||||
|
if (data.type === Msg.Type.NOTICE && !targetedAtUser) {
|
||||||
|
chan = network.channels[0];
|
||||||
|
} else {
|
||||||
chan = new Chan({
|
chan = new Chan({
|
||||||
type: Chan.Type.QUERY,
|
type: Chan.Type.QUERY,
|
||||||
name: target
|
name: target
|
||||||
@ -46,6 +58,7 @@ module.exports = function(irc, network) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var self = data.nick === irc.user.nick;
|
var self = data.nick === irc.user.nick;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user