| ... |
... |
@@ -233,9 +233,19 @@ def __init__(self, workspace_id, account, jid, type_): |
|
233
|
233
|
self.show_all()
|
|
234
|
234
|
|
|
235
|
235
|
def update_avatar(self):
|
|
236
|
|
- contact = app.contacts.get_contact(self.account, self.jid)
|
|
237
|
|
-
|
|
238
|
236
|
scale = self.get_scale_factor()
|
|
|
237
|
+
|
|
|
238
|
+ if self.type == 'pm':
|
|
|
239
|
+ jid, resource = app.get_room_and_nick_from_fjid(self.jid)
|
|
|
240
|
+ contact = app.contacts.get_gc_contact(
|
|
|
241
|
+ self.account, jid, resource)
|
|
|
242
|
+ avatar = contact.get_avatar(AvatarSize.ROSTER,
|
|
|
243
|
+ scale,
|
|
|
244
|
+ contact.show.value)
|
|
|
245
|
+ self._ui.avatar_image.set_from_surface(avatar)
|
|
|
246
|
+ return
|
|
|
247
|
+
|
|
|
248
|
+ contact = app.contacts.get_contact(self.account, self.jid)
|
|
239
|
249
|
if contact:
|
|
240
|
250
|
if contact.is_groupchat:
|
|
241
|
251
|
avatar = app.contacts.get_avatar(self.account,
|
| ... |
... |
@@ -257,6 +267,16 @@ def update_avatar(self): |
|
257
|
267
|
self._ui.avatar_image.set_from_surface(avatar)
|
|
258
|
268
|
|
|
259
|
269
|
def update_name(self):
|
|
|
270
|
+ if self.type == 'pm':
|
|
|
271
|
+ jid, resource = app.get_room_and_nick_from_fjid(self.jid)
|
|
|
272
|
+ contact = app.contacts.get_gc_contact(
|
|
|
273
|
+ self.account, jid, resource)
|
|
|
274
|
+ client = app.get_client(self.account)
|
|
|
275
|
+ muc_name = get_groupchat_name(client, jid)
|
|
|
276
|
+ self._ui.name_label.set_text(
|
|
|
277
|
+ f'{contact.get_shown_name()} ({muc_name})')
|
|
|
278
|
+ return
|
|
|
279
|
+
|
|
260
|
280
|
contact = app.contacts.get_contact(self.account, self.jid)
|
|
261
|
281
|
if contact is None:
|
|
262
|
282
|
self._ui.name_label.set_text(self.jid)
|