From e159fd2492c28c1ef4ab64828ca0e8c2de877b41 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 3 Jul 2020 21:14:39 +0200 Subject: Only query entity caps when we need them --- plugins/omemo/src/jingle/jet_omemo.vala | 6 +++--- plugins/omemo/src/jingle/jingle_helper.vala | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'plugins/omemo/src') diff --git a/plugins/omemo/src/jingle/jet_omemo.vala b/plugins/omemo/src/jingle/jet_omemo.vala index edca809c..b3343855 100644 --- a/plugins/omemo/src/jingle/jet_omemo.vala +++ b/plugins/omemo/src/jingle/jet_omemo.vala @@ -29,12 +29,12 @@ public class Module : XmppStreamModule, Jet.EnvelopEncoding { stream.get_module(ServiceDiscovery.Module.IDENTITY).remove_feature(stream, NS_URI); } - public bool is_available(XmppStream stream, Jid full_jid) { - bool? has_feature = stream.get_flag(ServiceDiscovery.Flag.IDENTITY).has_entity_feature(full_jid, NS_URI); + public async bool is_available(XmppStream stream, Jid full_jid) { + bool? has_feature = yield stream.get_module(ServiceDiscovery.Module.IDENTITY).has_entity_feature(stream, full_jid, NS_URI); if (has_feature == null || !(!)has_feature) { return false; } - return stream.get_module(Xep.Jet.Module.IDENTITY).is_available(stream, full_jid); + return yield stream.get_module(Xep.Jet.Module.IDENTITY).is_available(stream, full_jid); } public string get_type_uri() { diff --git a/plugins/omemo/src/jingle/jingle_helper.vala b/plugins/omemo/src/jingle/jingle_helper.vala index 6814fd00..4b6ed646 100644 --- a/plugins/omemo/src/jingle/jingle_helper.vala +++ b/plugins/omemo/src/jingle/jingle_helper.vala @@ -13,7 +13,7 @@ public class EncryptionHelper : JingleFileEncryptionHelper, Object { return true; } - public bool can_encrypt(Conversation conversation, FileTransfer file_transfer, Jid? full_jid) { + public async bool can_encrypt(Conversation conversation, FileTransfer file_transfer, Jid? full_jid) { XmppStream? stream = stream_interactor.get_stream(conversation.account); if (stream == null) return false; @@ -22,12 +22,12 @@ public class EncryptionHelper : JingleFileEncryptionHelper, Object { if (full_jid == null) { foreach (Jid test_jid in resources) { - if (stream.get_module(Module.IDENTITY).is_available(stream, test_jid)) { + if (yield stream.get_module(Module.IDENTITY).is_available(stream, test_jid)) { return true; } } } else { - if (stream.get_module(Module.IDENTITY).is_available(stream, full_jid)) { + if (yield stream.get_module(Module.IDENTITY).is_available(stream, full_jid)) { return true; } } -- cgit v1.2.3-70-g09d2