Don't trigger OMEMOInitialized
if something went wrong.
This commit is contained in:
parent
dd0c0b6c56
commit
337e267594
20
dist/converse.js
vendored
20
dist/converse.js
vendored
@ -57001,13 +57001,13 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
|
|||||||
this.fetch({
|
this.fetch({
|
||||||
'success': () => {
|
'success': () => {
|
||||||
if (!_converse.omemo_store.get('device_id')) {
|
if (!_converse.omemo_store.get('device_id')) {
|
||||||
this.generateBundle().then(resolve).catch(resolve);
|
this.generateBundle().then(resolve).catch(reject);
|
||||||
} else {
|
} else {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'error': () => {
|
'error': () => {
|
||||||
this.generateBundle().then(resolve).catch(resolve);
|
this.generateBundle().then(resolve).catch(reject);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -57350,15 +57350,25 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
|
|||||||
id = `converse.devicelists-${_converse.bare_jid}`;
|
id = `converse.devicelists-${_converse.bare_jid}`;
|
||||||
|
|
||||||
_converse.devicelists.browserStorage = new Backbone.BrowserStorage[storage](id);
|
_converse.devicelists.browserStorage = new Backbone.BrowserStorage[storage](id);
|
||||||
await fetchOwnDevices();
|
|
||||||
await restoreOMEMOSession();
|
try {
|
||||||
await _converse.omemo_store.publishBundle();
|
await fetchOwnDevices();
|
||||||
|
await restoreOMEMOSession();
|
||||||
|
await _converse.omemo_store.publishBundle();
|
||||||
|
} catch (e) {
|
||||||
|
_converse.log("Could not initialize OMEMO support", Strophe.LogLevel.ERROR);
|
||||||
|
|
||||||
|
_converse.log(e, Strophe.LogLevel.ERROR);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Triggered once OMEMO support has been initialized
|
* Triggered once OMEMO support has been initialized
|
||||||
* @event _converse#OMEMOInitialized
|
* @event _converse#OMEMOInitialized
|
||||||
* @example _converse.api.listen.on('OMEMOInitialized', () => { ... });
|
* @example _converse.api.listen.on('OMEMOInitialized', () => { ... });
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
_converse.api.trigger('OMEMOInitialized');
|
_converse.api.trigger('OMEMOInitialized');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -844,7 +844,6 @@ converse.plugins.add('converse-omemo', {
|
|||||||
* generated integer between 1 and 2^31 - 1.
|
* generated integer between 1 and 2^31 - 1.
|
||||||
*/
|
*/
|
||||||
const identity_keypair = await libsignal.KeyHelper.generateIdentityKeyPair();
|
const identity_keypair = await libsignal.KeyHelper.generateIdentityKeyPair();
|
||||||
|
|
||||||
const bundle = {},
|
const bundle = {},
|
||||||
identity_key = u.arrayBufferToBase64(identity_keypair.pubKey),
|
identity_key = u.arrayBufferToBase64(identity_keypair.pubKey),
|
||||||
device_id = generateDeviceID();
|
device_id = generateDeviceID();
|
||||||
@ -882,13 +881,13 @@ converse.plugins.add('converse-omemo', {
|
|||||||
this.fetch({
|
this.fetch({
|
||||||
'success': () => {
|
'success': () => {
|
||||||
if (!_converse.omemo_store.get('device_id')) {
|
if (!_converse.omemo_store.get('device_id')) {
|
||||||
this.generateBundle().then(resolve).catch(resolve);
|
this.generateBundle().then(resolve).catch(reject);
|
||||||
} else {
|
} else {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'error': () => {
|
'error': () => {
|
||||||
this.generateBundle().then(resolve).catch(resolve);
|
this.generateBundle().then(resolve).catch(reject);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1160,9 +1159,15 @@ converse.plugins.add('converse-omemo', {
|
|||||||
id = `converse.devicelists-${_converse.bare_jid}`;
|
id = `converse.devicelists-${_converse.bare_jid}`;
|
||||||
_converse.devicelists.browserStorage = new Backbone.BrowserStorage[storage](id);
|
_converse.devicelists.browserStorage = new Backbone.BrowserStorage[storage](id);
|
||||||
|
|
||||||
await fetchOwnDevices();
|
try {
|
||||||
await restoreOMEMOSession();
|
await fetchOwnDevices();
|
||||||
await _converse.omemo_store.publishBundle();
|
await restoreOMEMOSession();
|
||||||
|
await _converse.omemo_store.publishBundle();
|
||||||
|
} catch (e) {
|
||||||
|
_converse.log("Could not initialize OMEMO support", Strophe.LogLevel.ERROR);
|
||||||
|
_converse.log(e, Strophe.LogLevel.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Triggered once OMEMO support has been initialized
|
* Triggered once OMEMO support has been initialized
|
||||||
* @event _converse#OMEMOInitialized
|
* @event _converse#OMEMOInitialized
|
||||||
|
Loading…
Reference in New Issue
Block a user