From 6439afd5c6b51518af98728bb9eaee5a2137a8c3 Mon Sep 17 00:00:00 2001 From: JeDaYoshi Date: Sat, 3 Jul 2021 15:27:08 +0000 Subject: [PATCH 1/2] Fix nick-less PRIVMSGs from servers --- src/plugins/irc-events/message.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/irc-events/message.js b/src/plugins/irc-events/message.js index e86fc9b7..4aeeed21 100644 --- a/src/plugins/irc-events/message.js +++ b/src/plugins/irc-events/message.js @@ -27,6 +27,12 @@ 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); }); From 16177eb9f4a630c83e0c4fc241b2293ec4966d46 Mon Sep 17 00:00:00 2001 From: JeDaYoshi Date: Sat, 3 Jul 2021 21:06:16 +0000 Subject: [PATCH 2/2] Move server nick code to handleMessage --- src/plugins/irc-events/message.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/plugins/irc-events/message.js b/src/plugins/irc-events/message.js index 4aeeed21..0d67ff61 100644 --- a/src/plugins/irc-events/message.js +++ b/src/plugins/irc-events/message.js @@ -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 &&