aboutsummaryrefslogtreecommitdiff
path: root/plugins/http-files/src/manager.vala
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/http-files/src/manager.vala')
-rw-r--r--plugins/http-files/src/manager.vala14
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/http-files/src/manager.vala b/plugins/http-files/src/manager.vala
index 3be3c6a7..c27babe2 100644
--- a/plugins/http-files/src/manager.vala
+++ b/plugins/http-files/src/manager.vala
@@ -35,7 +35,11 @@ public class Manager : StreamInteractionModule, FileSender, Object {
stream_interactor.module_manager.get_module(file_transfer.account, UploadStreamModule.IDENTITY).upload(stream, file_transfer.input_stream, file_transfer.server_file_name, file_transfer.size, file_transfer.mime_type,
(stream, url_down) => {
uploaded(file_transfer, url_down);
- stream_interactor.get_module(MessageProcessor.IDENTITY).send_message(url_down, conversation);
+ file_transfer.info = url_down;
+ Entities.Message message = stream_interactor.get_module(MessageProcessor.IDENTITY).create_out_message(url_down, conversation);
+ message.encryption = Encryption.NONE;
+ stream_interactor.get_module(MessageProcessor.IDENTITY).send_message(message, conversation);
+ file_transfer.info = message.id.to_string();
},
(stream, error_str) => {
print(@"Failed getting upload url + $error_str\n");
@@ -97,11 +101,9 @@ public class FileMessageFilterDisplay : Plugins.MessageDisplayProvider, Object {
}
private bool message_is_file(Database db, Entities.Message message) {
- Qlite.QueryBuilder builder = db.file_transfer.select()
- .with(db.file_transfer.info, "=", message.body)
- .with(db.file_transfer.account_id, "=", message.account.id)
- .with(db.file_transfer.counterpart_id, "=", db.get_jid_id(message.counterpart));
- return builder.count() > 0;
+ Qlite.QueryBuilder builder = db.file_transfer.select().with(db.file_transfer.info, "=", message.id.to_string());
+ Qlite.QueryBuilder builder2 = db.file_transfer.select().with(db.file_transfer.info, "=", message.body);
+ return builder.count() > 0 || builder2.count() > 0;
}
}