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

View File

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