aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/content_item_store.vala
diff options
context:
space:
mode:
authorfrosty <frostinator33@airmail.cc>2026-10-26 10:21:57 -0400
committerfrosty <frostinator33@airmail.cc>2026-10-26 10:21:57 -0400
commit74aecd8b0986d07b50b7ce310d64e645b8b54e38 (patch)
tree560e6434f183eb54cd779936f3a4c9575146a066 /libdino/src/service/content_item_store.vala
parent3d7e90d401da02d430a87db0ec7e1db3a6f1a68f (diff)
parent4436001bb361ad4f9e4e05819214ecf0ea77c063 (diff)
Merge 'upstream/master'
Diffstat (limited to 'libdino/src/service/content_item_store.vala')
-rw-r--r--libdino/src/service/content_item_store.vala36
1 files changed, 35 insertions, 1 deletions
diff --git a/libdino/src/service/content_item_store.vala b/libdino/src/service/content_item_store.vala
index d74f9b05..5e440c76 100644
--- a/libdino/src/service/content_item_store.vala
+++ b/libdino/src/service/content_item_store.vala
@@ -1,7 +1,7 @@
using Gee;
using Dino.Entities;
-using Qlite;
+using Dino.Qlite;
using Xmpp;
namespace Dino {
@@ -26,6 +26,8 @@ public class ContentItemStore : StreamInteractionModule, Object {
this.db = db;
stream_interactor.get_module(FileManager.IDENTITY).received_file.connect(insert_file_transfer);
+ stream_interactor.get_module(FileManager2.IDENTITY).received_file.connect(insert_file_transfer);
+ stream_interactor.get_module(FileManager2.IDENTITY).received_file_group.connect(insert_file_group);
stream_interactor.get_module(MessageProcessor.IDENTITY).message_received.connect(announce_message);
stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect(announce_message);
stream_interactor.get_module(Calls.IDENTITY).call_incoming.connect(insert_call);
@@ -88,6 +90,13 @@ public class ContentItemStore : StreamInteractionModule, Object {
return call_item;
}
break;
+ case 4:
+ FileTransferGroup? file_group = stream_interactor.get_module(FileTransferStorage.IDENTITY).get_file_group_by_id(foreign_id, conversation);
+ if (file_group != null) {
+ var file_group_item = new FileGroupItem(file_group, conversation, id);
+ return file_group_item;
+ }
+ break;
default:
warning("Unknown content item type: %i", content_type);
break;
@@ -300,6 +309,16 @@ public class ContentItemStore : StreamInteractionModule, Object {
new_item(item, conversation);
}
+ private void insert_file_group(FileTransferGroup file_group, Conversation conversation) {
+ FileGroupItem item = new FileGroupItem(file_group, conversation, file_group.id);
+ // TODO fix local time
+ item.id = db.add_content_item(conversation, item.time, item.time, 4, file_group.id, false);
+ if (collection_conversations.has_key(conversation)) {
+ collection_conversations.get(conversation).insert_item(item);
+ }
+ new_item(item, conversation);
+ }
+
private void insert_call(Call call, CallState call_state, Conversation conversation) {
CallItem item = new CallItem(call, conversation, -1);
item.id = db.add_content_item(conversation, call.time, call.local_time, 3, call.id, false);
@@ -415,6 +434,21 @@ public class FileItem : ContentItem {
}
}
+public class FileGroupItem : ContentItem {
+ public const string TYPE = "file_group";
+
+ public FileTransferGroup file_group;
+ public Conversation conversation;
+
+ public FileGroupItem(FileTransferGroup file_group, Conversation conversation, int id) {
+ var file_transfer = file_group.file_transfers.get(0);
+ base(id, TYPE, file_transfer.from, file_transfer.time, file_transfer.encryption, Message.Marked.NONE);
+
+ this.file_group = file_group;
+ this.conversation = conversation;
+ }
+}
+
public class CallItem : ContentItem {
public const string TYPE = "call";