aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-07-03 21:14:39 +0200
committerfiaxh <git@lightrise.org>2020-07-16 23:31:19 +0200
commite159fd2492c28c1ef4ab64828ca0e8c2de877b41 (patch)
treeaca3c42854b08b5683a1c85e7c7a74fd0a4bdf0d /plugins
parent74f7fa897f9aec298eeadcfc7a7b971f06498858 (diff)
downloaddino-e159fd2492c28c1ef4ab64828ca0e8c2de877b41.tar.gz
dino-e159fd2492c28c1ef4ab64828ca0e8c2de877b41.zip
Only query entity caps when we need them
Diffstat (limited to 'plugins')
-rw-r--r--plugins/http-files/src/file_sender.vala10
-rw-r--r--plugins/omemo/src/jingle/jet_omemo.vala6
-rw-r--r--plugins/omemo/src/jingle/jingle_helper.vala6
3 files changed, 11 insertions, 11 deletions
diff --git a/plugins/http-files/src/file_sender.vala b/plugins/http-files/src/file_sender.vala
index cb8839f3..25db49b9 100644
--- a/plugins/http-files/src/file_sender.vala
+++ b/plugins/http-files/src/file_sender.vala
@@ -57,13 +57,13 @@ public class HttpFileSender : FileSender, Object {
}
}
- public bool can_send(Conversation conversation, FileTransfer file_transfer) {
+ public async bool can_send(Conversation conversation, FileTransfer file_transfer) {
if (!max_file_sizes.has_key(conversation.account)) return false;
return file_transfer.size < max_file_sizes[conversation.account];
}
- public long get_file_size_limit(Conversation conversation) {
+ public async long get_file_size_limit(Conversation conversation) {
long? max_size = max_file_sizes[conversation.account];
if (max_size != null) {
return max_size;
@@ -71,17 +71,17 @@ public class HttpFileSender : FileSender, Object {
return -1;
}
- public bool can_encrypt(Conversation conversation, FileTransfer file_transfer) {
+ public async bool can_encrypt(Conversation conversation, FileTransfer file_transfer) {
return false;
}
- public bool is_upload_available(Conversation conversation) {
+ public async bool is_upload_available(Conversation conversation) {
lock (max_file_sizes) {
return max_file_sizes.has_key(conversation.account);
}
}
- public long get_max_file_size(Account account) {
+ public async long get_max_file_size(Account account) {
lock (max_file_sizes) {
return max_file_sizes[account];
}
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;
}
}