Bug 1143238 - Rejoining an existing MUC fails. r=clokep
--- 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)