From 10adf716f3b94073f099dfb18ecdaf41dafcab2d Mon Sep 17 00:00:00 2001 From: fiaxh Date: Wed, 11 Nov 2020 11:27:31 +0100 Subject: Fix incoming muc voice request notification --- main/src/ui/application.vala | 9 ++++++--- main/src/ui/notifications.vala | 7 ++++--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'main') diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index 90c83562..7c473d2f 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -138,11 +138,14 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { }); add_action(accept_muc_invite_action); - SimpleAction accept_voice_request_action = new SimpleAction("accept-voice-request", VariantType.INT32); + SimpleAction accept_voice_request_action = new SimpleAction("accept-voice-request", new VariantType.tuple(new VariantType[]{VariantType.INT32, VariantType.STRING})); accept_voice_request_action.activate.connect((variant) => { - Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation_by_id(variant.get_int32()); + int conversation_id = variant.get_child_value(0).get_int32(); + Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation_by_id(conversation_id); if (conversation == null) return; - stream_interactor.get_module(MucManager.IDENTITY).change_role(conversation.account, conversation.counterpart, conversation.nickname, "participant"); + + string nick = variant.get_child_value(1).get_string(); + stream_interactor.get_module(MucManager.IDENTITY).change_role(conversation.account, conversation.counterpart, nick, "participant"); }); add_action(accept_voice_request_action); diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala index c68ab0ff..134c757a 100644 --- a/main/src/ui/notifications.vala +++ b/main/src/ui/notifications.vala @@ -141,7 +141,7 @@ public class Notifications : Object { GLib.Application.get_default().send_notification(null, notification); } - private async void on_voice_request_received(Account account, Jid room_jid, Jid from_jid, string? nick, string? role, string? label) { + private async void on_voice_request_received(Account account, Jid room_jid, Jid from_jid, string nick) { Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(room_jid, account, Conversation.Type.GROUPCHAT); if (conversation == null) return; @@ -156,9 +156,10 @@ public class Notifications : Object { notification.set_icon(get_pixbuf_icon(jid_avatar)); } catch (Error e) { } - notification.set_default_action_and_target_value("app.accept-voice-request", new Variant.int32(conversation.id)); + Variant variant = new Variant.tuple(new Variant[] {new Variant.int32(conversation.id), new Variant.string(nick)}); + notification.set_default_action_and_target_value("app.accept-voice-request", variant); 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); + notification.add_button_with_target_value(_("Accept"), "app.accept-voice-request", variant); GLib.Application.get_default().send_notification(null, notification); } -- cgit v1.2.3-70-g09d2