Commit d53caf11 authored by JC Brand's avatar JC Brand

Make sure presence stanza is sent out after roster update

specifically also when localstorage is populated
parent f68712a5
......@@ -4,7 +4,7 @@ Changelog
0.6.6 (2013-10-08)
------------------
* Bugfix: Presence stanza sent out before roster has been initialized [jcbrand]
* Bugfix: Presence stanza must be sent out only after roster has been initialized [jcbrand]
0.6.5 (2013-10-08)
------------------
......
......@@ -127,6 +127,7 @@
// Module-level variables
// ----------------------
this.callback = callback || function () {};
this.initial_presence_sent = 0;
this.msg_counter = 0;
// Module-level functions
......@@ -2190,17 +2191,6 @@
},
rosterHandler: function (items) {
if ((items.length === 0) || (items.length === _.where(items, {subscription:'none'}).length)) {
// The presence stanza is sent out once all
// roster contacts have been added and rendered.
// See RosterView's render method.
//
// If there aren't any roster contacts, we still
// want to send a presence stanza, so we do it here.
converse.xmppstatus.sendPresence();
return true;
}
this.cleanCache(items);
_.each(items, function (item, index, items) {
if (this.isSelf(item.jid)) { return; }
......@@ -2227,6 +2217,17 @@
}
}
}, this);
if (!converse.initial_presence_sent) {
/* Once we've sent out our initial presence stanza, we'll
* start receiving presence stanzas from our contacts.
* We therefore only want to do this after our roster has
* been set up (otherwise we can't meaningfully process
* incoming presence stanzas).
*/
converse.initial_presence_sent = 1;
converse.xmppstatus.sendPresence();
}
},
handleIncomingSubscription: function (jid) {
......@@ -2454,7 +2455,6 @@
// can show the roster.
this.$el.show();
}
converse.xmppstatus.sendPresence();
}
}
// Hide the headings if there are no contacts under them
......
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