aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/jingle_file_transfers.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-09-02 16:47:41 +0200
committerfiaxh <git@lightrise.org>2020-09-07 15:14:29 +0200
commit49bcbdaa517e5d6f8d4860db70ae0a9960e2c519 (patch)
tree7275f69dc7ef36022eace7cfbc0bb7f66be60824 /libdino/src/service/jingle_file_transfers.vala
parente327a88898a90543f1de851274274139642c9a21 (diff)
downloaddino-49bcbdaa517e5d6f8d4860db70ae0a9960e2c519.tar.gz
dino-49bcbdaa517e5d6f8d4860db70ae0a9960e2c519.zip
Fix initial file encryption displaying
fixes #831
Diffstat (limited to 'libdino/src/service/jingle_file_transfers.vala')
-rw-r--r--libdino/src/service/jingle_file_transfers.vala19
1 files changed, 10 insertions, 9 deletions
diff --git a/libdino/src/service/jingle_file_transfers.vala b/libdino/src/service/jingle_file_transfers.vala
index 6482e2e7..016939bf 100644
--- a/libdino/src/service/jingle_file_transfers.vala
+++ b/libdino/src/service/jingle_file_transfers.vala
@@ -11,7 +11,7 @@ public interface JingleFileEncryptionHelper : Object {
public abstract async bool can_encrypt(Conversation conversation, FileTransfer file_transfer, Jid? full_jid = null);
public abstract string? get_precondition_name(Conversation conversation, FileTransfer file_transfer);
public abstract Object? get_precondition_options(Conversation conversation, FileTransfer file_transfer);
- public abstract FileMeta complete_meta(FileTransfer file_transfer, FileReceiveData receive_data, FileMeta file_meta, Xmpp.Xep.JingleFileTransfer.FileTransfer jingle_transfer);
+ public abstract Encryption get_encryption(Xmpp.Xep.JingleFileTransfer.FileTransfer jingle_transfer);
}
public class JingleFileEncryptionHelperTransferOnly : JingleFileEncryptionHelper, Object {
@@ -27,8 +27,8 @@ public class JingleFileEncryptionHelperTransferOnly : JingleFileEncryptionHelper
public Object? get_precondition_options(Conversation conversation, FileTransfer file_transfer) {
return null;
}
- public FileMeta complete_meta(FileTransfer file_transfer, FileReceiveData receive_data, FileMeta file_meta, Xmpp.Xep.JingleFileTransfer.FileTransfer jingle_transfer) {
- return file_meta;
+ public Encryption get_encryption(Xmpp.Xep.JingleFileTransfer.FileTransfer jingle_transfer) {
+ return Encryption.NONE;
}
}
@@ -79,15 +79,19 @@ public class JingleFileProvider : FileProvider, Object {
}
public async FileMeta get_meta_info(FileTransfer file_transfer, FileReceiveData receive_data, FileMeta file_meta) throws FileReceiveError {
+ return file_meta;
+ }
+
+ public Encryption get_encryption(FileTransfer file_transfer, FileReceiveData receive_data, FileMeta file_meta) {
Xmpp.Xep.JingleFileTransfer.FileTransfer? jingle_file_transfer = file_transfers[file_transfer.info];
if (jingle_file_transfer == null) {
throw new FileReceiveError.DOWNLOAD_FAILED("Transfer data not available anymore");
}
- FileMeta meta = file_meta;
foreach (JingleFileEncryptionHelper helper in JingleFileHelperRegistry.instance.encryption_helpers.values) {
- meta = helper.complete_meta(file_transfer, receive_data, meta, jingle_file_transfer);
+ var encryption = helper.get_encryption(jingle_file_transfer);
+ if (encryption != Encryption.NONE) return encryption;
}
- return meta;
+ return Encryption.NONE;
}
public async InputStream download(FileTransfer file_transfer, FileReceiveData receive_data, FileMeta file_meta) throws FileReceiveError {
@@ -97,9 +101,6 @@ public class JingleFileProvider : FileProvider, Object {
if (jingle_file_transfer == null) {
throw new FileReceiveError.DOWNLOAD_FAILED("Transfer data not available anymore");
}
- foreach (JingleFileEncryptionHelper helper in JingleFileHelperRegistry.instance.encryption_helpers.values) {
- helper.complete_meta(file_transfer, receive_data, file_meta, jingle_file_transfer);
- }
try {
jingle_file_transfer.accept(stream);
} catch (IOError e) {