diff options
Diffstat (limited to 'libdino/src/service/notification_events.vala')
-rw-r--r-- | libdino/src/service/notification_events.vala | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libdino/src/service/notification_events.vala b/libdino/src/service/notification_events.vala index 7e99dcf9..7039d1cf 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,17 @@ 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.begin(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 +136,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); |