aboutsummaryrefslogtreecommitdiff
path: root/libdino
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2018-01-28 20:56:27 +0100
committerfiaxh <git@mx.ax.lt>2018-01-28 22:00:22 +0100
commitf6db249c92e8fd25c1cb52872d3a647be034b626 (patch)
tree65ebb9d61fd27dcfd37a26137f507413193902d3 /libdino
parentbec810e234a7b9783eb8f35e2ffd7c60d75e09c7 (diff)
downloaddino-f6db249c92e8fd25c1cb52872d3a647be034b626.tar.gz
dino-f6db249c92e8fd25c1cb52872d3a647be034b626.zip
Only display transferred images, display file names, open in system viewer, include and use pgp embedded file names
Diffstat (limited to 'libdino')
-rw-r--r--libdino/src/entity/file_transfer.vala6
-rw-r--r--libdino/src/service/file_manager.vala3
-rw-r--r--libdino/src/service/message_processor.vala9
3 files changed, 12 insertions, 6 deletions
diff --git a/libdino/src/entity/file_transfer.vala b/libdino/src/entity/file_transfer.vala
index 22474396..e2542e74 100644
--- a/libdino/src/entity/file_transfer.vala
+++ b/libdino/src/entity/file_transfer.vala
@@ -98,8 +98,8 @@ public class FileTransfer : Object {
notify.connect(on_update);
}
- public string get_uri() {
- return Path.build_filename(Dino.get_storage_dir(), "files", path);
+ public File get_file() {
+ return File.new_for_path(Path.build_filename(Dino.get_storage_dir(), "files", path));
}
private void on_update(Object o, ParamSpec sp) {
@@ -118,6 +118,8 @@ public class FileTransfer : Object {
update_builder.set(db.file_transfer.local_time, (long) local_time.to_unix()); break;
case "encryption":
update_builder.set(db.file_transfer.encryption, encryption); break;
+ case "file-name":
+ update_builder.set(db.file_transfer.file_name, file_name); break;
case "state":
update_builder.set(db.file_transfer.state, state); break;
case "provider":
diff --git a/libdino/src/service/file_manager.vala b/libdino/src/service/file_manager.vala
index 571bbaab..3def24af 100644
--- a/libdino/src/service/file_manager.vala
+++ b/libdino/src/service/file_manager.vala
@@ -126,8 +126,7 @@ public class FileManager : StreamInteractionModule, Object {
save_file(file_transfer);
try {
- File file = File.new_for_path(file_transfer.get_uri());
- FileInfo file_info = file.query_info("*", FileQueryInfoFlags.NONE);
+ FileInfo file_info = file_transfer.get_file().query_info("*", FileQueryInfoFlags.NONE);
file_transfer.mime_type = file_info.get_content_type();
} catch (Error e) { }
diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala
index 56ce2bfe..d8a25da1 100644
--- a/libdino/src/service/message_processor.vala
+++ b/libdino/src/service/message_processor.vala
@@ -37,11 +37,16 @@ public class MessageProcessor : StreamInteractionModule, Object {
received_pipeline.connect(new MamMessageListener(stream_interactor));
}
- public void send_message(string text, Conversation conversation) {
+ public Entities.Message send_text(string text, Conversation conversation) {
Entities.Message message = create_out_message(text, conversation);
+ return send_message(message, conversation);
+ }
+
+ public Entities.Message send_message(Entities.Message message, Conversation conversation) {
stream_interactor.get_module(MessageStorage.IDENTITY).add_message(message, conversation);
send_xmpp_message(message, conversation);
message_sent(message, conversation);
+ return message;
}
public void send_unsent_messages(Account account, Jid? jid = null) {
@@ -224,7 +229,7 @@ public class MessageProcessor : StreamInteractionModule, Object {
}
}
- private Entities.Message create_out_message(string text, Conversation conversation) {
+ public Entities.Message create_out_message(string text, Conversation conversation) {
Entities.Message message = new Entities.Message(text);
message.type_ = Util.get_message_type_for_conversation(conversation);
message.stanza_id = random_uuid();