From 0bfab9d1d97d07679da4a2a1db5903782a74ae49 Mon Sep 17 00:00:00 2001 From: Samuel Hand Date: Sun, 5 Aug 2018 01:26:36 +0100 Subject: Fix bug where OMEMO not avaiable with a newly added contact --- plugins/omemo/src/manager.vala | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'plugins/omemo') diff --git a/plugins/omemo/src/manager.vala b/plugins/omemo/src/manager.vala index 8654a4f5..7c8d8976 100644 --- a/plugins/omemo/src/manager.vala +++ b/plugins/omemo/src/manager.vala @@ -71,6 +71,7 @@ public class Manager : StreamInteractionModule, Object { stream_interactor.account_added.connect(on_account_added); stream_interactor.get_module(MessageProcessor.IDENTITY).received_pipeline.connect(received_message_listener); stream_interactor.get_module(MessageProcessor.IDENTITY).pre_message_send.connect(on_pre_message_send); + stream_interactor.get_module(PresenceManager.IDENTITY).mutual_subscription.connect(on_mutual_subscription); } private class ReceivedMessageListener : MessageListener { @@ -171,6 +172,13 @@ public class Manager : StreamInteractionModule, Object { } } + private void on_mutual_subscription(Jid jid, Account account) { + XmppStream? stream = stream_interactor.get_stream(account); + if(stream == null) return; + + stream_interactor.module_manager.get_module(account, StreamModule.IDENTITY).request_user_devicelist((!)stream, jid); + } + 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).device_list_loaded.connect((jid, devices) => on_device_list_loaded(account, jid, devices)); @@ -341,7 +349,6 @@ public class Manager : StreamInteractionModule, Object { if (flag.has_room_feature(conversation.counterpart, Xep.Muc.Feature.NON_ANONYMOUS) && flag.has_room_feature(conversation.counterpart, Xep.Muc.Feature.MEMBERS_ONLY)) { foreach(Jid jid in stream_interactor.get_module(MucManager.IDENTITY).get_offline_members(conversation.counterpart, conversation.account)) { if (!trust_manager.is_known_address(conversation.account, jid.bare_jid)) { - module.request_user_devicelist(stream, jid.bare_jid); return false; } } @@ -349,11 +356,8 @@ public class Manager : StreamInteractionModule, Object { } else { return false; } - } else if (!trust_manager.is_known_address(conversation.account, conversation.counterpart.bare_jid)) { - module.request_user_devicelist(stream, conversation.counterpart.bare_jid); - return false; } - return true; + return trust_manager.is_known_address(conversation.account, conversation.counterpart.bare_jid); } public static void start(StreamInteractor stream_interactor, Database db) { -- cgit v1.2.3-70-g09d2