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.
This commit is contained in:
JC Brand 2016-12-05 10:48:13 +00:00
parent 7ad39cfdb9
commit 088eb03b54
2 changed files with 6 additions and 7 deletions

View File

@ -57,7 +57,7 @@
"po2json": "^0.4.4",
"requirejs": "2.3.2",
"requirejs-undertemplate": "~0.0.4",
"strophe.js": "1.2.10",
"strophe.js": "https://github.com/strophe/strophejs#4eeee581da8789d7c5ae0096496f2a6533ec7d74",
"snyk": "^1.21.2",
"strophejs-plugins": "0.0.7",
"text": "requirejs/text#2.0.15",

View File

@ -876,30 +876,29 @@
* (String) exit_msg: Optional message to indicate your
* reason for leaving.
*/
this.hide();
this.occupantsview.model.reset();
this.occupantsview.model.browserStorage._clear();
if (!converse.connection.connected ||
this.model.get('connection_status') === Strophe.Status.DISCONNECTED) {
// Don't send out a stanza if we're not connected.
this.cleanup();
return;
}
var presenceid = converse.connection.getUniqueId();
var presence = $pres({
type: "unavailable",
id: presenceid,
from: converse.connection.jid,
to: this.getRoomJIDAndNick()
});
if (exit_msg !== null) {
presence.c("status", exit_msg);
}
converse.connection.addHandler(
converse.connection.sendPresence(
presence,
this.cleanup.bind(this),
null, "presence", null, presenceid
this.cleanup.bind(this),
2000
);
converse.connection.send(presence);
},
renderConfigurationForm: function (stanza) {