From fcad0f088ad3c9399ff7d63806841ec2bb3ec20c Mon Sep 17 00:00:00 2001 From: Bronko Date: Sun, 8 Apr 2018 21:55:29 +0200 Subject: [PATCH] save hash and mime_type of avatar when receiving vCard from server in case the avatar is not changed by the user we must resend the still valid hash. if we do not save the hash here, gajim advertises an empty photo element after publishing the vCard, which removes the avatar for all receiving clients of the photo element update --- gajim/profile_window.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gajim/profile_window.py b/gajim/profile_window.py index 9820208ef..462a75735 100644 --- a/gajim/profile_window.py +++ b/gajim/profile_window.py @@ -29,6 +29,7 @@ from gi.repository import GdkPixbuf import base64 import time import logging +import hashlib from gajim import gtkgui_helpers from gajim import dialogs @@ -229,6 +230,9 @@ class ProfileWindow: continue self.avatar_encoded = photo_encoded photo_decoded = base64.b64decode(photo_encoded.encode('utf-8')) + self.avatar_sha = hashlib.sha1(photo_decoded).hexdigest() + if 'TYPE' in vcard_[i]: + self.avatar_mime_type = vcard_[i]['TYPE'] pixbuf = gtkgui_helpers.get_pixbuf_from_data(photo_decoded) if pixbuf is None: continue