aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-02-21 01:10:32 +0100
committerfiaxh <git@lightrise.org>2019-03-14 17:39:31 +0100
commit94eea332b13abad9e331dd04f2917e40086a2bd4 (patch)
tree7d00b2456b3740d1f164d681e5ed36c410fc1624 /plugins
parent161e4c19862be0ea6572f7701d37acc1c16b8147 (diff)
downloaddino-94eea332b13abad9e331dd04f2917e40086a2bd4.tar.gz
dino-94eea332b13abad9e331dd04f2917e40086a2bd4.zip
Wait for account to be persisted before creating omemo_db.identity entry
fixes #128
Diffstat (limited to 'plugins')
-rw-r--r--plugins/omemo/src/manager.vala9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/omemo/src/manager.vala b/plugins/omemo/src/manager.vala
index ee82b9d5..d0df6c8e 100644
--- a/plugins/omemo/src/manager.vala
+++ b/plugins/omemo/src/manager.vala
@@ -165,7 +165,7 @@ public class Manager : StreamInteractionModule, Object {
}
private void on_account_added(Account account) {
- stream_interactor.module_manager.get_module(account, StreamModule.IDENTITY).store_created.connect((store) => on_store_created(account, store));
+ stream_interactor.module_manager.get_module(account, StreamModule.IDENTITY).store_created.connect((store) => on_store_created.begin(account, store));
stream_interactor.module_manager.get_module(account, StreamModule.IDENTITY).device_list_loaded.connect((jid, devices) => on_device_list_loaded(account, jid, devices));
stream_interactor.module_manager.get_module(account, StreamModule.IDENTITY).bundle_fetched.connect((jid, device_id, bundle) => on_bundle_fetched(account, jid, device_id, bundle));
}
@@ -302,7 +302,12 @@ public class Manager : StreamInteractionModule, Object {
}
}
- private void on_store_created(Account account, Store store) {
+ private async void on_store_created(Account account, Store store) {
+ // If the account is not yet persisted, wait for that and then continue - without identity.account_id the entry isn't worth much.
+ if (account.id == -1) {
+ account.notify["id"].connect(() => on_store_created.callback());
+ yield;
+ }
Qlite.Row? row = db.identity.row_with(db.identity.account_id, account.id).inner;
int identity_id = -1;
bool publish_identity = false;