Commit 088eb03b authored by JC Brand's avatar JC Brand

Immediately hide chat room on close.

Also, use sendPresence from latest strophe so that we have a timeout in case a
responding presence never comes.
parent 7ad39cfd
...@@ -876,30 +876,29 @@ ...@@ -876,30 +876,29 @@
* (String) exit_msg: Optional message to indicate your * (String) exit_msg: Optional message to indicate your
* reason for leaving. * reason for leaving.
*/ */
this.hide();
this.occupantsview.model.reset(); this.occupantsview.model.reset();
this.occupantsview.model.browserStorage._clear(); this.occupantsview.model.browserStorage._clear();
if (!converse.connection.connected || if (!converse.connection.connected ||
this.model.get('connection_status') === Strophe.Status.DISCONNECTED) { this.model.get('connection_status') === Strophe.Status.DISCONNECTED) {
// Don't send out a stanza if we're not connected. // Don't send out a stanza if we're not connected.
this.cleanup(); this.cleanup();
return; return;
} }
var presenceid = converse.connection.getUniqueId();
var presence = $pres({ var presence = $pres({
type: "unavailable", type: "unavailable",
id: presenceid,
from: converse.connection.jid, from: converse.connection.jid,
to: this.getRoomJIDAndNick() to: this.getRoomJIDAndNick()
}); });
if (exit_msg !== null) { if (exit_msg !== null) {
presence.c("status", exit_msg); presence.c("status", exit_msg);
} }
converse.connection.addHandler( converse.connection.sendPresence(
presence,
this.cleanup.bind(this),
this.cleanup.bind(this), this.cleanup.bind(this),
null, "presence", null, presenceid 2000
); );
converse.connection.send(presence);
}, },
renderConfigurationForm: function (stanza) { renderConfigurationForm: function (stanza) {
......
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