From cdb4d77259e6c361aaca64a483a43d7441f4803d Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 19 Mar 2021 23:07:40 +0100 Subject: Add support for unencrypted RTP calls to libdino Co-authored-by: Marvin W --- libdino/src/service/content_item_store.vala | 33 ++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'libdino/src/service/content_item_store.vala') 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; + } +} + } -- cgit v1.2.3-54-g00ecf