aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorSamuel Hand <samuel.hand@openmailbox.org>2018-07-17 19:47:07 +0100
committerSamuel Hand <samuel.hand@openmailbox.org>2018-07-17 19:47:07 +0100
commit56a0da154a06e3d6c4c1773bb74cdc18eefb04d8 (patch)
tree539ddbe05b3311ddd9e46eb3e1338a32eb2a2b97 /plugins
parent74c48e65671058225ea77a6d1cc48e12798d9d21 (diff)
downloaddino-56a0da154a06e3d6c4c1773bb74cdc18eefb04d8.tar.gz
dino-56a0da154a06e3d6c4c1773bb74cdc18eefb04d8.zip
Properly check if a MUC is viable for sending OMEMO messages
Diffstat (limited to 'plugins')
-rw-r--r--plugins/omemo/src/manager.vala16
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/omemo/src/manager.vala b/plugins/omemo/src/manager.vala
index 9bfa93d6..b80c5283 100644
--- a/plugins/omemo/src/manager.vala
+++ b/plugins/omemo/src/manager.vala
@@ -335,8 +335,20 @@ public class Manager : StreamInteractionModule, Object {
if (stream == null) return false;
StreamModule? module = ((!)stream).get_module(StreamModule.IDENTITY);
if (module == null) return false;
- //return ((!)module).is_known_address(conversation.counterpart.bare_jid);
- return true;
+ 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;
+ if (flag.has_room_feature(conversation.counterpart, Xep.Muc.Feature.NON_ANONYMOUS)) {
+ foreach(Jid jid in stream_interactor.get_module(MucManager.IDENTITY).get_offline_members(conversation.counterpart, conversation.account)) {
+ if (!((!)module).is_known_address(jid.bare_jid)) return false;
+ }
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return ((!)module).is_known_address(conversation.counterpart.bare_jid);
+ }
}
public static void start(StreamInteractor stream_interactor, Database db) {