Merge pull request #157 from thelounge/astorije/no-highlight-self

Make sure self messages are never highlighted
This commit is contained in:
Max-P 2016-03-08 03:17:46 -05:00
commit 0306c97939

View File

@ -36,17 +36,13 @@ module.exports = function(irc, network) {
text = text.replace(/^\u0001ACTION|\u0001$/g, ""); text = text.replace(/^\u0001ACTION|\u0001$/g, "");
} }
var highlight = false; var self = (data.from.toLowerCase() === irc.me.toLowerCase());
textSplit.forEach(function(w) {
if (w.replace(/^@/, "").toLowerCase().indexOf(irc.me.toLowerCase()) === 0) {
highlight = true;
}
});
var self = false; // Self messages are never highlighted
if (data.from.toLowerCase() === irc.me.toLowerCase()) { // Non-self messages are highlighted as soon as the nick is detected
self = true; var highlight = !self && textSplit.some(function(w) {
} return (w.replace(/^@/, "").toLowerCase().indexOf(irc.me.toLowerCase()) === 0);
});
if (chan.id !== client.activeChannel) { if (chan.id !== client.activeChannel) {
chan.unread++; chan.unread++;