aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/notifications.vala
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui/notifications.vala')
-rw-r--r--main/src/ui/notifications.vala19
1 files changed, 10 insertions, 9 deletions
diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala
index e495e629..0bc03a73 100644
--- a/main/src/ui/notifications.vala
+++ b/main/src/ui/notifications.vala
@@ -72,13 +72,13 @@ public class Notifications : Object {
break;
}
if (stream_interactor.get_module(MucManager.IDENTITY).is_groupchat(conversation.counterpart, conversation.account)) {
- string muc_occupant = Util.get_display_name(stream_interactor, content_item.jid, conversation.account);
+ string muc_occupant = Util.get_participant_display_name(stream_interactor, conversation, content_item.jid);
text = @"$muc_occupant: $text";
}
notifications[conversation].set_title(display_name);
notifications[conversation].set_body(text);
try {
- Cairo.ImageSurface conversation_avatar = yield (new AvatarGenerator(40, 40)).draw_conversation(stream_interactor, conversation);
+ Cairo.ImageSurface conversation_avatar = (yield Util.get_conversation_avatar_drawer(stream_interactor, conversation)).size(40, 40).draw_image_surface();
notifications[conversation].set_icon(get_pixbuf_icon(conversation_avatar));
} catch (Error e) { }
window.get_application().send_notification(conversation.id.to_string(), notifications[conversation]);
@@ -95,7 +95,7 @@ public class Notifications : Object {
Notification notification = new Notification(_("Subscription request"));
notification.set_body(conversation.counterpart.to_string());
try {
- Cairo.ImageSurface jid_avatar = yield (new AvatarGenerator(40, 40)).draw_jid(stream_interactor, conversation.counterpart, conversation.account);
+ 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) { }
notification.set_default_action_and_target_value("app.open-conversation", new Variant.int32(conversation.id));
@@ -119,21 +119,22 @@ public class Notifications : Object {
}
private async void on_invite_received(Account account, Jid room_jid, Jid from_jid, string? password, string? reason) {
- string display_name = Util.get_display_name(stream_interactor, from_jid, account);
+ Conversation direct_conversation = new Conversation(from_jid, account, Conversation.Type.CHAT);
+ string display_name = Util.get_participant_display_name(stream_interactor, direct_conversation, from_jid);
string display_room = room_jid.bare_jid.to_string();
Notification notification = new Notification(_("Invitation to %s").printf(display_room));
string body = _("%s invited you to %s").printf(display_name, display_room);
notification.set_body(body);
try {
- Cairo.ImageSurface jid_avatar = yield (new AvatarGenerator(40, 40)).draw_jid(stream_interactor, from_jid, account);
+ Cairo.ImageSurface jid_avatar = (yield Util.get_conversation_avatar_drawer(stream_interactor, direct_conversation)).size(40, 40).draw_image_surface();
notification.set_icon(get_pixbuf_icon(jid_avatar));
} catch (Error e) { }
- Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(room_jid, account, Conversation.Type.GROUPCHAT);
- notification.set_default_action_and_target_value("app.open-muc-join", new Variant.int32(conversation.id));
- notification.add_button_with_target_value(_("Deny"), "app.deny-invite", conversation.id);
- notification.add_button_with_target_value(_("Accept"), "app.open-muc-join", conversation.id);
+ Conversation group_conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(room_jid, account, Conversation.Type.GROUPCHAT);
+ notification.set_default_action_and_target_value("app.open-muc-join", new Variant.int32(group_conversation.id));
+ notification.add_button_with_target_value(_("Deny"), "app.deny-invite", group_conversation.id);
+ notification.add_button_with_target_value(_("Accept"), "app.open-muc-join", group_conversation.id);
window.get_application().send_notification(null, notification);
}