Browse Source

P4TB-396: use disable_all_sync_channels() in Sync startup.

master
Jörg Knobloch 1 year ago
parent
commit
c8813c108e
3 changed files with 21 additions and 3 deletions
  1. +5
    -0
      addon/content/modules/pEp.js
  2. +14
    -0
      addon/content/modules/pEpAdapter.js
  3. +2
    -3
      addon/content/pEpForThunderbird.js

+ 5
- 0
addon/content/modules/pEp.js View File

@ -275,6 +275,11 @@ class pEp {
return this.adapter.disable_identity_for_sync(identity);
}
async disable_all_sync_channels() {
this.log.info("pEp: disable_all_sync_channels()");
return this.adapter.disable_all_sync_channels();
}
async leaveDeviceGroup() {
this.log.info("pEp: leaveDeviceGroup()");
return this.adapter.leave_device_group();


+ 14
- 0
addon/content/modules/pEpAdapter.js View File

@ -36,6 +36,7 @@ const API_METHOD_GET_SET_OWN_KEY = "set_own_key";
const API_METHOD_ENABLE_IDENTITY_FOR_SYNC = "enable_identity_for_sync";
const API_METHOD_DISABLE_IDENTITY_FOR_SYNC = "disable_identity_for_sync";
const API_METHOD_DISABLE_ALL_SYNC_CHANNELS = "disable_all_sync_channels";
const API_METHOD_LEAVE_DEVICE_GROUP = "leave_device_group";
const API_METHOD_DELIVER_HANDSHAKE_RESULT = "deliverHandshakeResult";
const API_METHOD_START_SYNC = "startSync";
@ -749,6 +750,19 @@ class pEpAdapter {
});
}
async disable_all_sync_channels() {
this.log.info("pEpAdapter.js: disable_all_sync_channels()");
let params = [];
return this.delegateCallPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_DISABLE_ALL_SYNC_CHANNELS,
params,
).then((response) => response.result.return).catch((err) => {
this.log.error(err.message);
throw err;
});
}
async leave_device_group(identity) {
this.log.info("pEpAdapter.js: leave_device_group()");
let params = [];


+ 2
- 3
addon/content/pEpForThunderbird.js View File

@ -115,7 +115,7 @@ class pEpForThunderbird extends pEp {
MailServices.mfn.addListener(this, Ci.nsIMsgFolderNotificationService.msgAdded);
// Check adapter version.
const MIN_REQUIRED_VERSION = "0.22.0";
const MIN_REQUIRED_VERSION = "0.22.1";
let version = this.synchronise(this.serverVersion());
this.log.info(`Adapter version ${version.api_version} (${version.name})`);
let win = Services.wm.getMostRecentWindow("mail:3pane");
@ -165,6 +165,7 @@ class pEpForThunderbird extends pEp {
TbSync.setupSync(this);
// Communicate all own identities to the engine.
this.synchronise(this.disable_all_sync_channels());
for (let identity of fixIterator(MailServices.accounts.allIdentities, Ci.nsIMsgIdentity)) {
this.identityKeys.push(identity.key);
this.identityEmails.push(identity.email);
@ -173,8 +174,6 @@ class pEpForThunderbird extends pEp {
this.synchronise(this.myself(id));
if (id.enableSync) {
this.synchronise(this.enableIdentityForSync(id));
} else {
this.synchronise(this.disableIdentityForSync(id));
}
}


Loading…
Cancel
Save