Move server nick code to handleMessage

This commit is contained in:
JeDaYoshi 2021-07-03 21:06:16 +00:00
parent 6439afd5c6
commit 16177eb9f4
No known key found for this signature in database
GPG Key ID: 8060B288C274219D

View File

@ -11,12 +11,6 @@ module.exports = function (irc, network) {
const client = this;
irc.on("notice", function (data) {
// Some servers send notices without any nickname
if (!data.nick) {
data.from_server = true;
data.nick = data.hostname || network.host;
}
data.type = Msg.Type.NOTICE;
handleMessage(data);
});
@ -27,12 +21,6 @@ module.exports = function (irc, network) {
});
irc.on("privmsg", function (data) {
// Some servers send messages without any nickname
if (!data.nick) {
data.from_server = true;
data.nick = data.hostname || network.host;
}
data.type = Msg.Type.MESSAGE;
handleMessage(data);
});
@ -50,6 +38,12 @@ module.exports = function (irc, network) {
let showInActive = false;
const self = data.nick === irc.user.nick;
// Some servers send messages without any nickname
if (!data.nick) {
data.from_server = true;
data.nick = data.hostname || network.host;
}
// Check if the sender is in our ignore list
const shouldIgnore =
!self &&