diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index 050884558e508d73ea90d51eefb66fb3cafa5d02..2dfd97f1e5a3323168f00db1b2fed0c42cb038a0 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -1621,7 +1621,11 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, # we know real jid, save it in db st += ' (%s)' % jid gajim.logger.write('gcstatus', who, st, show) - if avatar_sha: + if avatar_sha or avatar_sha == '': + if avatar_sha == '': + # contact has no avatar + puny_nick = helpers.sanitize_filename(resource) + gajim.interface.remove_avatar_files(jid_stripped, puny_nick) if self.vcard_shas.has_key(who): if avatar_sha != self.vcard_shas[who]: # avatar has been updated diff --git a/src/gajim.py b/src/gajim.py index cdc8af0a50a48f82c2e2f316c2799fb1a29ee7ac..48aba65d707c55e229bc40761d38769505ded0e6 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -1196,10 +1196,12 @@ class Interface: path_to_bw_file = path_to_file + '_notif_size_bw.png' bwbuf.save(path_to_bw_file, 'png') - def remove_avatar_files(self, jid): + def remove_avatar_files(self, jid, puny_nick = None): '''remove avatar files of a jid''' puny_jid = helpers.sanitize_filename(jid) path_to_file = os.path.join(gajim.AVATAR_PATH, puny_jid) + if puny_nick: + path_to_file = os.path.join(path_to_file, puny_nick) for ext in ('.jpeg', '.png', '_notif_size_colored.png', '_notif_size_bw.png'): path_to_original_file = path_to_file + ext