Display every nickname notification

This commit is contained in:
Sébastien Hut 2015-04-04 15:19:34 +02:00 committed by Sébastien Hut
parent 9c501c7a54
commit 9e4e35d297
1 changed files with 11 additions and 10 deletions

View File

@ -101,21 +101,22 @@ module.exports = HumanModel.define({
addMessage: function (message, notify) {
message.owner = me.jid.bare;
var mentions = [];
this.resources.forEach(function (resource) {
if (message.body.toLowerCase().indexOf('@' + resource.mucDisplayName) >= 0) {
mentions.push('@' + resource.mucDisplayName);
}
});
if (message.body.toLowerCase().indexOf('@all') >= 0) {
mentions.push('@all');
}
message.mentions = mentions;
var mine = message.from.resource === this.nick;
if (mine) {
message._mucMine = true;
}
else {
var mentions = [];
if (message.body.toLowerCase().indexOf('@' + this.nick.toLowerCase()) >= 0) {
mentions.push('@' + this.nick);
}
if (message.body.toLowerCase().indexOf('@all') >= 0) {
mentions.push('@all');
}
message.mentions = mentions;
}
if (notify && (!this.activeContact || (this.activeContact && !app.state.focused)) && !mine) {
this.unreadCount++;