Commit 53643ab5 authored by JC Brand's avatar JC Brand

core: Close chats when logging out, before disconnecting

Otherwise rooms cannot be exited properly.

Also, no need to call `_tearDown` in `logOut` when `connection.disconnect` gets
called since it will get called afterwards in the handler.
parent 3e8e7705
...@@ -577,13 +577,15 @@ ...@@ -577,13 +577,15 @@
}; };
this.logOut = function () { this.logOut = function () {
_converse.chatboxviews.closeAllChatBoxes();
_converse.clearSession();
_converse.setDisconnectionCause(_converse.LOGOUT, undefined, true); _converse.setDisconnectionCause(_converse.LOGOUT, undefined, true);
if (!_.isUndefined(_converse.connection)) { if (!_.isUndefined(_converse.connection)) {
_converse.connection.disconnect(); _converse.connection.disconnect();
} else {
_converse._tearDown();
} }
_converse.chatboxviews.closeAllChatBoxes();
_converse.clearSession();
_converse._tearDown();
_converse.emit('logout'); _converse.emit('logout');
}; };
......
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