diff cagou/plugins/plugin_wid_chat.py @ 458:1dd6db69406a

core: update avatar handling following backend changes: new avatar data format is handled. When ContactItem is created, avatar and nicknames are requested to backend if they are not already in cache.
author Goffi <goffi@goffi.org>
date Tue, 14 Apr 2020 21:14:44 +0200
parents 642cd2435e26
children 3c9ba4a694ef
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.py	Wed Apr 01 23:59:00 2020 +0200
+++ b/cagou/plugins/plugin_wid_chat.py	Tue Apr 14 21:14:44 2020 +0200
@@ -320,7 +320,12 @@
 
     def update(self, update_dict):
         if 'avatar' in update_dict:
-            self.avatar.source = update_dict['avatar']
+            avatar_data = update_dict['avatar']
+            if avatar_data is None:
+                source = G.host.getDefaultAvatar()
+            else:
+                source = avatar_data['path']
+            self.avatar.source = source
         if 'status' in update_dict:
             status = update_dict['status']
             self.delivery.text =  '\u2714' if status == 'delivered' else ''