|
@@ -33,7 +33,7 @@ import {
|
|
cleanup,
|
|
cleanup,
|
|
initClientConfig,
|
|
initClientConfig,
|
|
initPlugins,
|
|
initPlugins,
|
|
- initSession,
|
|
|
|
|
|
+ setUserJID,
|
|
initSessionStorage,
|
|
initSessionStorage,
|
|
registerGlobalEventHandlers
|
|
registerGlobalEventHandlers
|
|
} from './utils/init.js';
|
|
} from './utils/init.js';
|
|
@@ -152,7 +152,7 @@ export const api = _converse.api = {
|
|
// We also call `_proto._doDisconnect` so that connection event handlers
|
|
// We also call `_proto._doDisconnect` so that connection event handlers
|
|
// for the old transport are removed.
|
|
// for the old transport are removed.
|
|
if (api.connection.isType('websocket') && api.settings.get('bosh_service_url')) {
|
|
if (api.connection.isType('websocket') && api.settings.get('bosh_service_url')) {
|
|
- await _converse.setUserJID(_converse.bare_jid);
|
|
|
|
|
|
+ await setUserJID(_converse.bare_jid);
|
|
_converse.connection._proto._doDisconnect();
|
|
_converse.connection._proto._doDisconnect();
|
|
_converse.connection._proto = new Strophe.Bosh(_converse.connection);
|
|
_converse.connection._proto = new Strophe.Bosh(_converse.connection);
|
|
_converse.connection.service = api.settings.get('bosh_service_url');
|
|
_converse.connection.service = api.settings.get('bosh_service_url');
|
|
@@ -161,9 +161,9 @@ export const api = _converse.api = {
|
|
// When reconnecting anonymously, we need to connect with only
|
|
// When reconnecting anonymously, we need to connect with only
|
|
// the domain, not the full JID that we had in our previous
|
|
// the domain, not the full JID that we had in our previous
|
|
// (now failed) session.
|
|
// (now failed) session.
|
|
- await _converse.setUserJID(api.settings.get("jid"));
|
|
|
|
|
|
+ await setUserJID(api.settings.get("jid"));
|
|
} else {
|
|
} else {
|
|
- await _converse.setUserJID(_converse.bare_jid);
|
|
|
|
|
|
+ await setUserJID(_converse.bare_jid);
|
|
}
|
|
}
|
|
_converse.connection._proto._doDisconnect();
|
|
_converse.connection._proto._doDisconnect();
|
|
_converse.connection._proto = new Strophe.Websocket(_converse.connection);
|
|
_converse.connection._proto = new Strophe.Websocket(_converse.connection);
|
|
@@ -173,7 +173,7 @@ export const api = _converse.api = {
|
|
// When reconnecting anonymously, we need to connect with only
|
|
// When reconnecting anonymously, we need to connect with only
|
|
// the domain, not the full JID that we had in our previous
|
|
// the domain, not the full JID that we had in our previous
|
|
// (now failed) session.
|
|
// (now failed) session.
|
|
- await _converse.setUserJID(api.settings.get("jid"));
|
|
|
|
|
|
+ await setUserJID(api.settings.get("jid"));
|
|
}
|
|
}
|
|
|
|
|
|
if (_converse.connection?.reconnecting) {
|
|
if (_converse.connection?.reconnecting) {
|
|
@@ -302,7 +302,7 @@ export const api = _converse.api = {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (jid) {
|
|
if (jid) {
|
|
- jid = await _converse.setUserJID(jid);
|
|
|
|
|
|
+ jid = await setUserJID(jid);
|
|
}
|
|
}
|
|
|
|
|
|
// See whether there is a BOSH session to re-attach to
|
|
// See whether there is a BOSH session to re-attach to
|
|
@@ -647,30 +647,6 @@ _converse.initConnection = function () {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-/**
|
|
|
|
- * Stores the passed in JID for the current user, potentially creating a
|
|
|
|
- * resource if the JID is bare.
|
|
|
|
- *
|
|
|
|
- * Given that we can only create an XMPP connection if we know the domain of
|
|
|
|
- * the server connect to and we only know this once we know the JID, we also
|
|
|
|
- * call {@link _converse.initConnection } (if necessary) to make sure that the
|
|
|
|
- * connection is set up.
|
|
|
|
- *
|
|
|
|
- * @method _converse#setUserJID
|
|
|
|
- * @emits _converse#setUserJID
|
|
|
|
- * @params { String } jid
|
|
|
|
- */
|
|
|
|
-_converse.setUserJID = async function (jid) {
|
|
|
|
- await initSession(_converse, jid);
|
|
|
|
- /**
|
|
|
|
- * Triggered whenever the user's JID has been updated
|
|
|
|
- * @event _converse#setUserJID
|
|
|
|
- */
|
|
|
|
- _converse.api.trigger('setUserJID');
|
|
|
|
- return jid;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
function setUpXMLLogging () {
|
|
function setUpXMLLogging () {
|
|
const lmap = {}
|
|
const lmap = {}
|
|
lmap[Strophe.LogLevel.DEBUG] = 'debug';
|
|
lmap[Strophe.LogLevel.DEBUG] = 'debug';
|