Fix voice request notification
This commit is contained in:
parent
b72ea08d03
commit
daf803e773
|
@ -159,7 +159,8 @@ protected class ConferenceDetailsFragment : Box {
|
|||
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();
|
||||
app.controller.select_conversation(conversation);
|
||||
joined();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue