Commit 2473fb13 authored by JC Brand's avatar JC Brand

On 2nd thought, don't query the msg text

I'm afraid it might get very expensive.
parent 29c2a964
...@@ -839,21 +839,15 @@ ...@@ -839,21 +839,15 @@
resource = Strophe.getResourceFromJid(jid), resource = Strophe.getResourceFromJid(jid),
sender = resource && Strophe.unescapeNode(resource) || '', sender = resource && Strophe.unescapeNode(resource) || '',
subject = $message.children('subject').text(), subject = $message.children('subject').text(),
text = $message.find('body').text(), dupes = msgid && this.model.messages.filter(function (msg) {
collision = msgid && this.model.messages.findWhere({'msgid': msgid}); // Find duplicates.
if (collision) { // Some bots (like HAL in the prosody chatroom)
// We already have a message with this id stored. // respond to commands with the same ID as the
// It might therefore be a duplicate, but we cannot yet be // original message. So we also check the sender.
// 100% sure. Some bots (like HAL in the prosody return msg.get('msgid') === msgid && msg.get('fullname') === sender;
// chatroom) respond to commands with the same ID as });
// the original message. We therefore also check whether if (dupes.length) {
// the sender is the same and then lastly whether the return true;
// message text is the same.
if (collision.get('fullname') === sender) {
if (this.model.messages.findWhere({'message': text})) {
return true;
}
}
} }
if (subject) { if (subject) {
this.$el.find('.chatroom-topic').text(subject).attr('title', subject); this.$el.find('.chatroom-topic').text(subject).attr('title', subject);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment