Commit 24956d8d authored by JC Brand's avatar JC Brand

Execute manual resource binding if necessary

parent 0688907e
...@@ -849,6 +849,8 @@ _converse.initialize = async function (settings, callback) { ...@@ -849,6 +849,8 @@ _converse.initialize = async function (settings, callback) {
} else if (status === Strophe.Status.DISCONNECTED) { } else if (status === Strophe.Status.DISCONNECTED) {
_converse.setDisconnectionCause(status, message); _converse.setDisconnectionCause(status, message);
_converse.onDisconnected(); _converse.onDisconnected();
} else if (status === Strophe.Status.BINDREQUIRED) {
_converse.bindResource();
} else if (status === Strophe.Status.ERROR) { } else if (status === Strophe.Status.ERROR) {
_converse.setConnectionStatus( _converse.setConnectionStatus(
status, status,
...@@ -1089,6 +1091,16 @@ _converse.initialize = async function (settings, callback) { ...@@ -1089,6 +1091,16 @@ _converse.initialize = async function (settings, callback) {
_converse.api.trigger('setUserJID'); _converse.api.trigger('setUserJID');
}; };
this.bindResource = async function () {
/**
* Synchronous event triggered before we send an IQ to bind the user's
* JID resource for this session.
* @event _converse#beforeResourceBinding
*/
await _converse.api.trigger('beforeResourceBinding', {'synchronous': true});
_converse.connection.bind();
};
this.onConnected = function (reconnecting) { this.onConnected = function (reconnecting) {
/* Called as soon as a new connection has been established, either /* Called as soon as a new connection has been established, either
* by logging in or by attaching to an existing BOSH session. * by logging in or by attaching to an existing BOSH session.
......
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