Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits: 88d8b3e5 by Daniel Brötzmann at 2021-02-09T19:21:09+01:00 ChatList: Add avatar and name for PMs
- - - - -
1 changed file:
- gajim/gtk/chat_list.py
Changes:
===================================== gajim/gtk/chat_list.py ===================================== @@ -233,9 +233,19 @@ def __init__(self, workspace_id, account, jid, type_): self.show_all()
def update_avatar(self): - contact = app.contacts.get_contact(self.account, self.jid) - scale = self.get_scale_factor() + + if self.type == 'pm': + jid, resource = app.get_room_and_nick_from_fjid(self.jid) + contact = app.contacts.get_gc_contact( + self.account, jid, resource) + avatar = contact.get_avatar(AvatarSize.ROSTER, + scale, + contact.show.value) + self._ui.avatar_image.set_from_surface(avatar) + return + + contact = app.contacts.get_contact(self.account, self.jid) if contact: if contact.is_groupchat: avatar = app.contacts.get_avatar(self.account, @@ -257,6 +267,16 @@ def update_avatar(self): self._ui.avatar_image.set_from_surface(avatar)
def update_name(self): + if self.type == 'pm': + jid, resource = app.get_room_and_nick_from_fjid(self.jid) + contact = app.contacts.get_gc_contact( + self.account, jid, resource) + client = app.get_client(self.account) + muc_name = get_groupchat_name(client, jid) + self._ui.name_label.set_text( + f'{contact.get_shown_name()} ({muc_name})') + return + contact = app.contacts.get_contact(self.account, self.jid) if contact is None: self._ui.name_label.set_text(self.jid)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/88d8b3e58fb45dd415a42220511c931e5...