Properly check if a MUC is viable for sending OMEMO messages

This commit is contained in:
Samuel Hand 2018-07-17 19:47:07 +01:00
parent 74c48e6567
commit 56a0da154a

View file

@ -335,8 +335,20 @@ public class Manager : StreamInteractionModule, Object {
if (stream == null) return false; if (stream == null) return false;
StreamModule? module = ((!)stream).get_module(StreamModule.IDENTITY); StreamModule? module = ((!)stream).get_module(StreamModule.IDENTITY);
if (module == null) return false; if (module == null) return false;
//return ((!)module).is_known_address(conversation.counterpart.bare_jid); 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; return true;
} else {
return false;
}
} else {
return ((!)module).is_known_address(conversation.counterpart.bare_jid);
}
} }
public static void start(StreamInteractor stream_interactor, Database db) { public static void start(StreamInteractor stream_interactor, Database db) {