Bug 799068 - Land in comm-central Instantbird's changes to chat/ - 3 - Bio 1701 - XMPP should strip whitespace around JID, r=fqueze, a=Standard8.
authorMook <mook.moz+bugs.instantbird@gmail.com>
Sat, 22 Sep 2012 00:17:30 +0200
changeset 13469 28133b63f623f7faa6e9438fda345433468589d8
parent 13468 a134b132bedfd365d1af86041a360a5d09d358a0
child 13470 b5d2e04a8d45bca2cd01f7b0d681e6fa9de5c748
push id705
push userflorian@queze.net
push dateWed, 10 Oct 2012 13:42:10 +0000
treeherdercomm-beta@e62841058776 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfqueze, Standard8
bugs799068
Bug 799068 - Land in comm-central Instantbird's changes to chat/ - 3 - Bio 1701 - XMPP should strip whitespace around JID, r=fqueze, a=Standard8.
chat/protocols/xmpp/xmpp.jsm
--- a/chat/protocols/xmpp/xmpp.jsm
+++ b/chat/protocols/xmpp/xmpp.jsm
@@ -931,22 +931,20 @@ const XMPPAccountPrototype = {
       if (c.localName == "PHOTO")
         buddy._saveIcon(c);
     }
     if (!foundFormattedName && buddy._vCardFormattedName)
       buddy.vCardFormattedName = "";
     buddy._vCardReceived = true;
   },
 
-  _normalizeJID: function(aJID) {
-    let slashIndex = aJID.indexOf("/");
-    if (slashIndex != -1)
-      aJID = aJID.substr(0, slashIndex);
-    return aJID.toLowerCase();
-  },
+  _normalizeJID: function(aJID)
+    aJID.trim()
+        .split("/", 1)[0] // up to first slash
+        .toLowerCase(),
 
   _parseJID: function(aJid) {
     let match =
       /^(?:([^"&'/:<>@]+)@)?([^@/<>'\"]+)(?:\/(.*))?$/.exec(aJid);
     if (!match)
       return null;
 
     let result = {