Initial attempt to sort out session issues.

This commit is contained in:
JC Brand 2014-09-18 09:29:31 +02:00
parent 90859a9811
commit ce06e7d2d6

View File

@ -219,7 +219,7 @@
this.forward_messages = false; this.forward_messages = false;
this.hide_muc_server = false; this.hide_muc_server = false;
this.i18n = locales.en; this.i18n = locales.en;
this.keepalive = true; this.keepalive = false;
this.message_carbons = false; this.message_carbons = false;
this.no_trimming = false; // Set to true for phantomjs tests (where browser apparently has no width) this.no_trimming = false; // Set to true for phantomjs tests (where browser apparently has no width)
this.play_sounds = false; this.play_sounds = false;
@ -454,13 +454,9 @@
}; };
this.showLoginForm = function () { this.showLoginForm = function () {
converse._tearDown();
var view = converse.chatboxviews.get('controlbox'); var view = converse.chatboxviews.get('controlbox');
view.model.set({connected:false}); view.model.set({connected:false});
if (typeof view.loginpanel !== 'undefined' && view.loginpanel.$el.is(':visible')) {
view.loginpanel.showLoginButton();
} else {
view.render();
}
}; };
this.onConnect = function (status, condition, reconnect) { this.onConnect = function (status, condition, reconnect) {
@ -4532,14 +4528,16 @@
}; };
this._tearDown = function () { this._tearDown = function () {
this.features.off().remove(); /* Remove those views which are only allowed with a valid
this.otr.destroy(); * connection.
this.chatboxes.off().remove(); */
this.chatboxviews.off().remove(); if (this.features) {
this.controlboxtoggle.off().remove(); this.features.off().remove();
this.minimized_chats.off().remove(); }
delete this.chatboxes; if (this.minimized_chats) {
delete this.features; this.minimized_chats.off().remove();
}
return this;
}; };
this._initialize = function () { this._initialize = function () {
@ -4549,6 +4547,7 @@
this.otr = new this.OTR(); this.otr = new this.OTR();
this.initSession(); this.initSession();
this.initConnection(); this.initConnection();
return this;
}; };
// Initialization // Initialization