diff options
author | fiaxh <git@lightrise.org> | 2021-03-19 23:07:40 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2021-03-21 12:41:39 +0100 |
commit | cdb4d77259e6c361aaca64a483a43d7441f4803d (patch) | |
tree | 6db053f9f0875f54261f3f7e7d6830612076e29d /libdino/src/service/notification_events.vala | |
parent | ef2e3c774cab82a94a5e34399f2013d64c3cf03b (diff) | |
download | dino-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/notification_events.vala')
-rw-r--r-- | libdino/src/service/notification_events.vala | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libdino/src/service/notification_events.vala b/libdino/src/service/notification_events.vala index 7e99dcf9..0243dbe5 100644 --- a/libdino/src/service/notification_events.vala +++ b/libdino/src/service/notification_events.vala @@ -24,12 +24,15 @@ public class NotificationEvents : StreamInteractionModule, Object { stream_interactor.get_module(ContentItemStore.IDENTITY).new_item.connect(on_content_item_received); stream_interactor.get_module(PresenceManager.IDENTITY).received_subscription_request.connect(on_received_subscription_request); + stream_interactor.get_module(MucManager.IDENTITY).invite_received.connect(on_invite_received); stream_interactor.get_module(MucManager.IDENTITY).voice_request_received.connect((account, room_jid, from_jid, nick) => { Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(room_jid, account, Conversation.Type.GROUPCHAT); if (conversation == null) return; notifier.notify_voice_request.begin(conversation, from_jid); }); + + stream_interactor.get_module(Calls.IDENTITY).call_incoming.connect(on_call_incoming); stream_interactor.connection_manager.connection_error.connect((account, error) => notifier.notify_connection_error.begin(account, error)); stream_interactor.get_module(ChatInteraction.IDENTITY).focused_in.connect((conversation) => { notifier.retract_content_item_notifications.begin(); @@ -91,6 +94,9 @@ public class NotificationEvents : StreamInteractionModule, Object { notifier.notify_file.begin(file_transfer, conversation, is_image, conversation_display_name, participant_display_name); } break; + case CallItem.TYPE: + // handled in `on_call_incoming` + break; } } @@ -101,6 +107,18 @@ public class NotificationEvents : StreamInteractionModule, Object { notifier.notify_subscription_request.begin(conversation); } + private void on_call_incoming(Call call, Conversation conversation, bool video) { + string conversation_display_name = get_conversation_display_name(stream_interactor, conversation, null); + + notifier.notify_call.begin(call, conversation, video, conversation_display_name); + call.notify["state"].connect(() => { + + if (call.state != Call.State.RINGING) { + notifier.retract_call_notification(call, conversation); + } + }); + } + private void on_invite_received(Account account, Jid room_jid, Jid from_jid, string? password, string? reason) { string inviter_display_name; if (room_jid.equals_bare(from_jid)) { @@ -119,6 +137,8 @@ public interface NotificationProvider : Object { public abstract async void notify_message(Message message, Conversation conversation, string conversation_display_name, string? participant_display_name); public abstract async void notify_file(FileTransfer file_transfer, Conversation conversation, bool is_image, string conversation_display_name, string? participant_display_name); + public abstract async void notify_call(Call call, Conversation conversation, bool video, string conversation_display_name); + public abstract async void retract_call_notification(Call call, Conversation conversation); public abstract async void notify_subscription_request(Conversation conversation); public abstract async void notify_connection_error(Account account, ConnectionManager.ConnectionError error); public abstract async void notify_muc_invite(Account account, Jid room_jid, Jid from_jid, string inviter_display_name); |