Bug 1143238 - Rejoining an existing MUC fails. r=clokep
authoraleth <aleth@instantbird.org>
Sat, 14 Mar 2015 01:33:27 +0100
changeset 17659 58bf649dc212fc176a19807bd12d8e449617b611
parent 17658 e1121167685e4d7b0ab58bc569af62e16426e19f
child 17660 9992f2609950bef23560388836db20defc84043e
push id10872
push useraleth@instantbird.org
push dateSat, 14 Mar 2015 12:37:39 +0000
treeherdercomm-central@58bf649dc212 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersclokep
bugs1143238
Bug 1143238 - Rejoining an existing MUC fails. r=clokep
chat/modules/jsProtoHelper.jsm
chat/protocols/xmpp/xmpp.jsm
--- a/chat/modules/jsProtoHelper.jsm
+++ b/chat/modules/jsProtoHelper.jsm
@@ -597,28 +597,25 @@ const GenericConvChatPrototype = {
     this._pingRegexp = new RegExp("(?:^|\\W)" + escapedNick + "(?:\\W|$)", "i");
   },
 
   _left: false,
   get left() this._left,
   set left(aLeft) {
     if (aLeft == this._left)
       return;
-
     this._left = aLeft;
-    if (this._left)
-      this.notifyObservers(null, "update-conv-chatleft");
+    this.notifyObservers(null, "update-conv-chatleft");
   },
 
   _joining: false,
   get joining() this._joining,
   set joining(aJoining) {
     if (aJoining == this._joining)
       return;
-
     this._joining = aJoining;
     this.notifyObservers(null, "update-conv-chatjoining");
   },
 
   getParticipants: function() {
     // Convert the values of the Map into a nsSimpleEnumerator.
     return new nsSimpleEnumerator(
       [participant for (participant of this._participants.values())]
--- a/chat/protocols/xmpp/xmpp.jsm
+++ b/chat/protocols/xmpp/xmpp.jsm
@@ -674,35 +674,38 @@ const XMPPAccountPrototype = {
       rv.values.nick = this._jid.node;
 
     return rv;
   },
   joinChat: function(aComponents) {
     let jid =
       aComponents.getValue("room") + "@" + aComponents.getValue("server");
     let nick = aComponents.getValue("nick");
-    if (this._mucs.has(jid)) {
-      let muc = this._mucs.get(jid);
+
+    let muc = this._mucs.get(jid);
+    if (muc) {
       if (!muc.left)
         return muc; // We are already in this conversation.
     }
+    else {
+      muc = new this._MUCConversationConstructor(this, jid, nick);
+      this._mucs.set(jid, muc);
+    }
+
+    // Store the prplIChatRoomFieldValues to enable later reconnections.
+    muc._chatRoomFields = aComponents;
+    muc.joining = true;
 
     let x;
     let password = aComponents.getValue("password");
     if (password) {
       x = Stanza.node("x", Stanza.NS.muc, null,
                       Stanza.node("password", null, null, password));
     }
     this.sendStanza(Stanza.presence({to: jid + "/" + nick}, x));
-
-    let muc = new this._MUCConversationConstructor(this, jid, nick);
-    this._mucs.set(jid, muc);
-    // Store the prplIChatRoomFieldValues to enable later reconnections.
-    muc._chatRoomFields = aComponents;
-    muc.joining = true;
     return muc;
   },
 
   _idleSince: 0,
   observe: function(aSubject, aTopic, aData) {
     if (aTopic == "idle-time-changed") {
       let idleTime = parseInt(aData, 10);
       if (idleTime)