aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-11-11 11:27:31 +0100
committerfiaxh <git@lightrise.org>2020-11-11 11:27:31 +0100
commit10adf716f3b94073f099dfb18ecdaf41dafcab2d (patch)
treec732f058d30a86092be3d92d1e3fbf40c9d7c1ac /main/src/ui
parentb2c7e9dfff2e00549fc23ad8e531d77daa6c2738 (diff)
downloaddino-10adf716f3b94073f099dfb18ecdaf41dafcab2d.tar.gz
dino-10adf716f3b94073f099dfb18ecdaf41dafcab2d.zip
Fix incoming muc voice request notification
Diffstat (limited to 'main/src/ui')
-rw-r--r--main/src/ui/application.vala9
-rw-r--r--main/src/ui/notifications.vala7
2 files changed, 10 insertions, 6 deletions
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);
}