Make sure highlight lookup stops as soon as a candidate is detected

This commit is contained in:
Jérémie Astori 2016-03-08 01:50:52 -05:00
parent 977b48649b
commit 6a6c41732d
1 changed files with 5 additions and 8 deletions

View File

@ -38,14 +38,11 @@ module.exports = function(irc, network) {
var self = (data.from.toLowerCase() === irc.me.toLowerCase()); var self = (data.from.toLowerCase() === irc.me.toLowerCase());
var highlight = false; // Self messages are never highlighted
if (!self) { // Self messages should never be highlighted // Non-self messages are highlighted as soon as the nick is detected
textSplit.forEach(function(w) { var highlight = !self && textSplit.some(function(w) {
if (w.replace(/^@/, "").toLowerCase().indexOf(irc.me.toLowerCase()) === 0) { return (w.replace(/^@/, "").toLowerCase().indexOf(irc.me.toLowerCase()) === 0);
highlight = true; });
}
});
}
if (chan.id !== client.activeChannel) { if (chan.id !== client.activeChannel) {
chan.unread++; chan.unread++;