Only match full words as mentions for notifications

fixes #185
This commit is contained in:
fiaxh 2017-10-22 01:24:57 +02:00
parent 9ea16b6d85
commit e49fc134dd

View file

@ -113,7 +113,9 @@ public class Notifications : Object {
Conversation.NotifySetting notify = conversation.get_notification_setting(stream_interactor); Conversation.NotifySetting notify = conversation.get_notification_setting(stream_interactor);
if (notify == Conversation.NotifySetting.OFF) return false; if (notify == Conversation.NotifySetting.OFF) return false;
Jid? nick = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account); Jid? nick = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account);
if (notify == Conversation.NotifySetting.HIGHLIGHT && nick != null && !message.body.contains(nick.resourcepart)) return false; if (notify == Conversation.NotifySetting.HIGHLIGHT && nick != null) {
return Regex.match_simple("""\b""" + Regex.escape_string(nick.resourcepart) + """\b""", message.body, RegexCompileFlags.CASELESS);
}
return true; return true;
} }