aboutsummaryrefslogtreecommitdiff
path: root/plugins/omemo
diff options
context:
space:
mode:
authorSamuel Hand <samuel.hand@openmailbox.org>2018-08-05 01:26:36 +0100
committerSamuel Hand <samuel.hand@openmailbox.org>2018-08-05 01:26:36 +0100
commit0bfab9d1d97d07679da4a2a1db5903782a74ae49 (patch)
tree25eac692887bc6602ae7597d3216e787f8ebc70d /plugins/omemo
parented3b36d0de50966de907766ac0fd6bc7713f0374 (diff)
downloaddino-0bfab9d1d97d07679da4a2a1db5903782a74ae49.tar.gz
dino-0bfab9d1d97d07679da4a2a1db5903782a74ae49.zip
Fix bug where OMEMO not avaiable with a newly added contact
Diffstat (limited to 'plugins/omemo')
-rw-r--r--plugins/omemo/src/manager.vala14
1 files changed, 9 insertions, 5 deletions
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) {