aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/content_item_store.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2021-03-19 23:07:40 +0100
committerfiaxh <git@lightrise.org>2021-03-21 12:41:39 +0100
commitcdb4d77259e6c361aaca64a483a43d7441f4803d (patch)
tree6db053f9f0875f54261f3f7e7d6830612076e29d /libdino/src/service/content_item_store.vala
parentef2e3c774cab82a94a5e34399f2013d64c3cf03b (diff)
downloaddino-cdb4d77259e6c361aaca64a483a43d7441f4803d.tar.gz
dino-cdb4d77259e6c361aaca64a483a43d7441f4803d.zip
Add support for unencrypted RTP calls to libdino
Co-authored-by: Marvin W <git@larma.de>
Diffstat (limited to 'libdino/src/service/content_item_store.vala')
-rw-r--r--libdino/src/service/content_item_store.vala33
1 files changed, 32 insertions, 1 deletions
diff --git a/libdino/src/service/content_item_store.vala b/libdino/src/service/content_item_store.vala
index 2de804a1..cde8dd10 100644
--- a/libdino/src/service/content_item_store.vala
+++ b/libdino/src/service/content_item_store.vala
@@ -29,6 +29,8 @@ public class ContentItemStore : StreamInteractionModule, Object {
stream_interactor.get_module(FileManager.IDENTITY).received_file.connect(insert_file_transfer);
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);
+ stream_interactor.get_module(Calls.IDENTITY).call_outgoing.connect(insert_call);
}
public void init(Conversation conversation, ContentItemCollection item_collection) {
@@ -51,7 +53,6 @@ public class ContentItemStore : StreamInteractionModule, Object {
Message? message = stream_interactor.get_module(MessageStorage.IDENTITY).get_message_by_id(foreign_id, conversation);
if (message != null) {
var message_item = new MessageItem(message, conversation, row[db.content_item.id]);
- message_item.time = time;
items.add(message_item);
}
break;
@@ -62,6 +63,13 @@ public class ContentItemStore : StreamInteractionModule, Object {
items.add(file_item);
}
break;
+ case 3:
+ Call? call = stream_interactor.get_module(CallStore.IDENTITY).get_call_by_id(foreign_id);
+ if (call != null) {
+ var call_item = new CallItem(call, conversation, row[db.content_item.id]);
+ items.add(call_item);
+ }
+ break;
}
}
@@ -173,6 +181,15 @@ public class ContentItemStore : StreamInteractionModule, Object {
}
}
+ private void insert_call(Call call, 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);
+ if (collection_conversations.has_key(conversation)) {
+ collection_conversations.get(conversation).insert_item(item);
+ }
+ new_item(item, conversation);
+ }
+
public bool get_item_hide(ContentItem content_item) {
return db.content_item.row_with(db.content_item.id, content_item.id)[db.content_item.hide, false];
}
@@ -292,4 +309,18 @@ public class FileItem : ContentItem {
}
}
+public class CallItem : ContentItem {
+ public const string TYPE = "call";
+
+ public Call call;
+ public Conversation conversation;
+
+ public CallItem(Call call, Conversation conversation, int id) {
+ base(id, TYPE, call.from, call.time, Encryption.NONE, Message.Marked.NONE);
+
+ this.call = call;
+ this.conversation = conversation;
+ }
+}
+
}