diff options
author | Samuel Hand <samuel.hand@openmailbox.org> | 2018-08-11 14:19:06 +0100 |
---|---|---|
committer | Samuel Hand <samuel.hand@openmailbox.org> | 2018-08-11 14:19:06 +0100 |
commit | 72cb5b4f90da59d5ec4660eca0e6d80e4669a49a (patch) | |
tree | 126119142ff4f304be52e45c76ade8e7864a9dbd /plugins/omemo/src | |
parent | 9d15c464c29536405f625e01dc964f48f1a0227d (diff) | |
download | dino-72cb5b4f90da59d5ec4660eca0e6d80e4669a49a.tar.gz dino-72cb5b4f90da59d5ec4660eca0e6d80e4669a49a.zip |
Fix OMEMO not working when the database is re-created for an existing account
Diffstat (limited to 'plugins/omemo/src')
-rw-r--r-- | plugins/omemo/src/manager.vala | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/omemo/src/manager.vala b/plugins/omemo/src/manager.vala index c75b15e2..51148681 100644 --- a/plugins/omemo/src/manager.vala +++ b/plugins/omemo/src/manager.vala @@ -316,9 +316,11 @@ public class Manager : StreamInteractionModule, Object { private void on_store_created(Account account, Store store) { Qlite.Row? row = db.identity.row_with(db.identity.account_id, account.id).inner; int identity_id = -1; + bool publish_identity = false; if (row == null) { // OMEMO not yet initialized, starting with empty base + publish_identity = true; try { store.identity_key_store.local_registration_id = Random.int_range(1, int32.MAX); @@ -349,14 +351,21 @@ public class Manager : StreamInteractionModule, Object { } else { print(@"OMEMO: store for $(account.bare_jid) is not persisted!"); } + + // Generated new device ID, ensure this gets added to the devicelist + if (publish_identity) { + XmppStream? stream = stream_interactor.get_stream(account); + if (stream == null) return; + StreamModule? module = ((!)stream).get_module(StreamModule.IDENTITY); + if(module == null) return; + module.request_user_devicelist(stream, account.bare_jid); + } } public bool can_encrypt(Entities.Conversation conversation) { XmppStream? stream = stream_interactor.get_stream(conversation.account); if (stream == null) return false; - StreamModule? module = ((!)stream).get_module(StreamModule.IDENTITY); - if (module == null) return false; if (stream_interactor.get_module(MucManager.IDENTITY).is_groupchat(conversation.counterpart, conversation.account)){ Xep.Muc.Flag? flag = stream.get_flag(Xep.Muc.Flag.IDENTITY); if (flag == null) return false; |