Bugfix. Need to strip the resource to get the room jid

This commit is contained in:
JC Brand 2016-06-16 17:24:58 +02:00
parent e12c165454
commit ee6d7ebd7a

View File

@ -57,14 +57,15 @@
var notify_all = converse.notify_all_room_messages,
jid = $message.attr('from'),
resource = Strophe.getResourceFromJid(jid),
room_jid = Strophe.getBareJidFromJid(jid),
sender = resource && Strophe.unescapeNode(resource) || '';
if (sender === '' || $message.find('delay').length > 0) {
return false;
}
var room = converse.chatboxes.get(Strophe.getBareJidFromJid(jid));
var room = converse.chatboxes.get(room_jid);
var body = $message.children('body').text();
var mentioned = (new RegExp("\\b"+room.get('nick')+"\\b")).test(body);
notify_all = notify_all === true || (_.isArray(notify_all) && _.contains(notify_all, jid));
notify_all = notify_all === true || (_.isArray(notify_all) && _.contains(notify_all, room_jid));
if (sender === room.get('nick') || (!notify_all && !mentioned)) {
return false;
}