Fix omemo not being available on first startup
This commit is contained in:
parent
7e156b3a75
commit
5d32a0ec3d
|
@ -340,15 +340,20 @@ public class Manager : StreamInteractionModule, Object {
|
||||||
if (flag == null) return false;
|
if (flag == null) return false;
|
||||||
if (flag.has_room_feature(conversation.counterpart, Xep.Muc.Feature.NON_ANONYMOUS) && flag.has_room_feature(conversation.counterpart, Xep.Muc.Feature.MEMBERS_ONLY)) {
|
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)) {
|
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)) return false;
|
if (!trust_manager.is_known_address(conversation.account, jid.bare_jid)) {
|
||||||
|
module.request_user_devicelist(stream, jid.bare_jid);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (!trust_manager.is_known_address(conversation.account, conversation.counterpart.bare_jid)) {
|
||||||
return trust_manager.is_known_address(conversation.account, conversation.counterpart.bare_jid);
|
module.request_user_devicelist(stream, conversation.counterpart.bare_jid);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void start(StreamInteractor stream_interactor, Database db) {
|
public static void start(StreamInteractor stream_interactor, Database db) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ public class StreamModule : XmppStreamModule {
|
||||||
store_created(store);
|
store_created(store);
|
||||||
received_pipeline_listener = new ReceivedPipelineListener(store);
|
received_pipeline_listener = new ReceivedPipelineListener(store);
|
||||||
stream.get_module(MessageModule.IDENTITY).received_pipeline.connect(received_pipeline_listener);
|
stream.get_module(MessageModule.IDENTITY).received_pipeline.connect(received_pipeline_listener);
|
||||||
|
print("Adding filtered notification\n");
|
||||||
stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NODE_DEVICELIST, (stream, jid, id, node) => on_devicelist(stream, jid, id, node));
|
stream.get_module(Pubsub.Module.IDENTITY).add_filtered_notification(stream, NODE_DEVICELIST, (stream, jid, id, node) => on_devicelist(stream, jid, id, node));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,9 +64,8 @@ public class StreamModule : XmppStreamModule {
|
||||||
if (Plugin.DEBUG) print(@"OMEMO: Not on device list, adding id\n");
|
if (Plugin.DEBUG) print(@"OMEMO: Not on device list, adding id\n");
|
||||||
node.put_node(new StanzaNode.build("device", NS_URI).put_attribute("id", store.local_registration_id.to_string()));
|
node.put_node(new StanzaNode.build("device", NS_URI).put_attribute("id", store.local_registration_id.to_string()));
|
||||||
stream.get_module(Pubsub.Module.IDENTITY).publish(stream, jid, NODE_DEVICELIST, NODE_DEVICELIST, id, node);
|
stream.get_module(Pubsub.Module.IDENTITY).publish(stream, jid, NODE_DEVICELIST, NODE_DEVICELIST, id, node);
|
||||||
} else {
|
|
||||||
publish_bundles_if_needed(stream, jid);
|
|
||||||
}
|
}
|
||||||
|
publish_bundles_if_needed(stream, jid);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<int32> device_list = new ArrayList<int32>();
|
ArrayList<int32> device_list = new ArrayList<int32>();
|
||||||
|
|
|
@ -118,8 +118,9 @@ public class TrustManager {
|
||||||
|
|
||||||
public Gee.List<int32> get_trusted_devices(Account account, Jid jid) {
|
public Gee.List<int32> get_trusted_devices(Account account, Jid jid) {
|
||||||
Gee.List<int32> devices = new ArrayList<int32>();
|
Gee.List<int32> devices = new ArrayList<int32>();
|
||||||
foreach (Row device in db.identity_meta.with_address(account.id, jid.to_string()).with(db.identity_meta.trust_level, "!=", Database.IdentityMetaTable.TrustLevel.UNKNOWN).with(db.identity_meta.trust_level, "!=", Database.IdentityMetaTable.TrustLevel.UNTRUSTED).without_null(db.identity_meta.identity_key_public_base64)) {
|
foreach (Row device in db.identity_meta.with_address(account.id, jid.to_string()).with(db.identity_meta.trust_level, "!=", Database.IdentityMetaTable.TrustLevel.UNTRUSTED)) {
|
||||||
devices.add(device[db.identity_meta.device_id]);
|
if(device[db.identity_meta.trust_level] != Database.IdentityMetaTable.TrustLevel.UNKNOWN || device[db.identity_meta.identity_key_public_base64] == null)
|
||||||
|
devices.add(device[db.identity_meta.device_id]);
|
||||||
}
|
}
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue