diff options
author | fiaxh <git@lightrise.org> | 2020-06-06 22:24:29 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2020-06-06 22:24:29 +0200 |
commit | daf803e7730555639517de18c89da42e73557679 (patch) | |
tree | 448613b3dfb9fc6e62f1868b13026c9916d3df42 /main | |
parent | b72ea08d03da64b485b92761aa79af377a58a8e1 (diff) | |
download | dino-daf803e7730555639517de18c89da42e73557679.tar.gz dino-daf803e7730555639517de18c89da42e73557679.zip |
Fix voice request notification
Diffstat (limited to 'main')
-rw-r--r-- | main/src/ui/add_conversation/conference_details_fragment.vala | 5 | ||||
-rw-r--r-- | main/src/ui/notifications.vala | 19 |
2 files changed, 12 insertions, 12 deletions
diff --git a/main/src/ui/add_conversation/conference_details_fragment.vala b/main/src/ui/add_conversation/conference_details_fragment.vala index d0a4c42e..0b8306e4 100644 --- a/main/src/ui/add_conversation/conference_details_fragment.vala +++ b/main/src/ui/add_conversation/conference_details_fragment.vala @@ -158,8 +158,9 @@ protected class ConferenceDetailsFragment : Box { ok_button.sensitive = true; if (join_result == null || join_result.nick != null) { Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(parsed_jid, account, Conversation.Type.GROUPCHAT); - Application app = GLib.Application.get_default() as Application; - app.controller.select_conversation(conversation);joined(); + Application app = GLib.Application.get_default() as Application; + app.controller.select_conversation(conversation); + joined(); return; } diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala index dc73bda5..ba6e5422 100644 --- a/main/src/ui/notifications.vala +++ b/main/src/ui/notifications.vala @@ -143,24 +143,23 @@ public class Notifications : Object { } private async void on_voice_request_received(Account account, Jid room_jid, Jid from_jid, string? nick, string? role, string? label) { - Conversation? direct_conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(room_jid, account, Conversation.Type.GROUPCHAT); - if (direct_conversation == null) return; - string display_name = Util.get_participant_display_name(stream_interactor, direct_conversation, from_jid); - string display_room = room_jid.bare_jid.to_string(); + Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(room_jid, account, Conversation.Type.GROUPCHAT); + if (conversation == null) return; + + string display_name = Util.get_participant_display_name(stream_interactor, conversation, from_jid); + string display_room = Util.get_conversation_display_name(stream_interactor, conversation); Notification notification = new Notification(_("Permission request")); string body = _("%s requests the permission to write in %s").printf(display_name, display_room); notification.set_body(body); try { - Cairo.ImageSurface jid_avatar = (yield Util.get_conversation_avatar_drawer(stream_interactor, direct_conversation)).size(40, 40).draw_image_surface(); + Cairo.ImageSurface jid_avatar = (yield Util.get_conversation_avatar_drawer(stream_interactor, conversation)).size(40, 40).draw_image_surface(); notification.set_icon(get_pixbuf_icon(jid_avatar)); } catch (Error e) { } - Conversation group_conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(room_jid, account, Conversation.Type.GROUPCHAT); - group_conversation.nickname = nick; - notification.set_default_action_and_target_value("app.accept-voice-request", new Variant.int32(group_conversation.id)); - notification.add_button_with_target_value(_("Deny"), "app.deny-voice-request", group_conversation.id); - notification.add_button_with_target_value(_("Accept"), "app.accept-voice-request", group_conversation.id); + notification.set_default_action_and_target_value("app.accept-voice-request", new Variant.int32(conversation.id)); + notification.add_button_with_target_value(_("Deny"), "app.deny-voice-request", conversation.id); + notification.add_button_with_target_value(_("Accept"), "app.accept-voice-request", conversation.id); GLib.Application.get_default().send_notification(null, notification); } |