From 977b48649b9dbdec8bd9e04178b136e691de117a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Mon, 7 Mar 2016 01:09:42 -0500 Subject: [PATCH] Fix #156: Make sure self messages are never highlighted --- src/plugins/irc-events/message.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/plugins/irc-events/message.js b/src/plugins/irc-events/message.js index f062571e..06ffeef8 100644 --- a/src/plugins/irc-events/message.js +++ b/src/plugins/irc-events/message.js @@ -36,16 +36,15 @@ module.exports = function(irc, network) { text = text.replace(/^\u0001ACTION|\u0001$/g, ""); } - var highlight = false; - textSplit.forEach(function(w) { - if (w.replace(/^@/, "").toLowerCase().indexOf(irc.me.toLowerCase()) === 0) { - highlight = true; - } - }); + var self = (data.from.toLowerCase() === irc.me.toLowerCase()); - var self = false; - if (data.from.toLowerCase() === irc.me.toLowerCase()) { - self = true; + var highlight = false; + if (!self) { // Self messages should never be highlighted + textSplit.forEach(function(w) { + if (w.replace(/^@/, "").toLowerCase().indexOf(irc.me.toLowerCase()) === 0) { + highlight = true; + } + }); } if (chan.id !== client.activeChannel) {