Enable automatic reconnecting when `prebind and prebind_url` are

specified.

fixes #330
updates #333
This commit is contained in:
JC Brand 2015-03-21 23:41:39 +01:00
parent 8d818fd5fd
commit 7cd27a71b3
2 changed files with 12 additions and 3 deletions

View File

@ -431,7 +431,6 @@
this.reconnect = function () {
converse.giveFeedback(__('Reconnecting'), 'error');
converse.emit('reconnect');
if (!converse.prebind) {
this.connection.connect(
this.connection.jid,
@ -443,6 +442,10 @@
this.connection.hold,
this.connection.route
);
} else if (converse.prebind_url) {
this.clearSession();
this._tearDown();
this.startNewBOSHSession();
}
};
@ -479,6 +482,7 @@
converse.giveFeedback(__('Authentication Failed'), 'error');
converse.connection.disconnect(__('Authentication Failed'));
} else if (status === Strophe.Status.DISCONNECTING) {
// FIXME: what about prebind?
if (!converse.connection.connected) {
converse.renderLoginPanel();
}
@ -554,8 +558,8 @@
this.clearSession = function () {
this.roster.browserStorage._clear();
this.session.browserStorage._clear();
// XXX: this should perhaps go into the beforeunload handler
converse.chatboxes.get('controlbox').save({'connected': false});
var controlbox = converse.chatboxes.get('controlbox');
controlbox.save({'connected': false});
};
this.setSession = function () {
@ -5439,6 +5443,9 @@
'initialize': function (settings, callback) {
converse.initialize(settings, callback);
},
'disconnect': function () {
converse.connection.disconnect();
},
'account': {
'logout': function () {
converse.logOut();

View File

@ -8,6 +8,8 @@ Changelog
* New configuration setting ``allow_contact_removal``. [jcbrand]
* Document that event handlers receive 'event' obj as first arg. [jcbrand]
* Add a test to check that notifications are played in chat rooms. [jcbrand]
* Enable automatic reconnection when ``prebind`` and ``prebind_url`` are
specified. [jcbrand]
* #339 Require the JID to be specified when using ``keepalive`` with
``prebind``. Also add a logout API method. [jcbrand]