From 58bbbe8b9dbd0b54d655b9888964135154476488 Mon Sep 17 00:00:00 2001 From: ichim-david Date: Sat, 2 Mar 2013 08:54:41 +0200 Subject: [PATCH] Cached message from attribute of messageReceived method --- converse.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/converse.js b/converse.js index e41d49c01..e10142324 100644 --- a/converse.js +++ b/converse.js @@ -1151,8 +1151,9 @@ }, messageReceived: function (message) { - var partner_jid, $message = $(message); - if ($message.attr('from') == xmppchat.connection.jid) { + var partner_jid, $message = $(message), + message_from = $message.attr('from'); + if ( message_from == xmppchat.connection.jid) { // FIXME: Forwarded messages should be sent to specific resources, not broadcasted return true; } @@ -1161,7 +1162,7 @@ $message = $forwarded.children('message'); } - var from = Strophe.getBareJidFromJid($message.attr('from')), + var from = Strophe.getBareJidFromJid(message_from), to = Strophe.getBareJidFromJid($message.attr('to')), view, resource; @@ -1171,7 +1172,7 @@ resource = Strophe.getResourceFromJid($message.attr('to')); } else { partner_jid = from; - resource = Strophe.getResourceFromJid($message.attr('from')); + resource = Strophe.getResourceFromJid(message_from); } view = this.views[partner_jid];