Author: jim++ Date: 2007-01-29 23:04:22 +0100 (Mon, 29 Jan 2007) New Revision: 7916
Modified: trunk/src/common/connection.py trunk/src/common/connection_handlers.py Log: Verify avatars'sha on hdd in muc too, don't send sha when disconnecting from muc
Modified: trunk/src/common/connection.py =================================================================== --- trunk/src/common/connection.py 2007-01-29 18:29:51 UTC (rev 7915) +++ trunk/src/common/connection.py 2007-01-29 22:04:22 UTC (rev 7916) @@ -1170,10 +1170,10 @@ ptype = None if show == 'offline': ptype = 'unavailable' - show = helpers.get_xmpp_show(show) + xmpp_show = helpers.get_xmpp_show(show) p = common.xmpp.Presence(to = '%s/%s' % (jid, nick), typ = ptype, - show = show, status = status) - if gajim.config.get('send_sha_in_gc_presence'): + show = xmpp_show, status = status) + if gajim.config.get('send_sha_in_gc_presence') and show != 'offline': p = self.add_sha(p, ptype != 'unavailable') # send instantly so when we go offline, status is sent to gc before we # disconnect from jabber server
Modified: trunk/src/common/connection_handlers.py =================================================================== --- trunk/src/common/connection_handlers.py 2007-01-29 18:29:51 UTC (rev 7915) +++ trunk/src/common/connection_handlers.py 2007-01-29 22:04:22 UTC (rev 7916) @@ -1669,12 +1669,22 @@ # 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 self.vcard_shas.has_key(who): # Verify sha cached in mem if avatar_sha != self.vcard_shas[who]: # avatar has been updated self.request_vcard(who, True) - else: + else: # Verify sha cached in hdd self.vcard_shas[who] = avatar_sha + cached_vcard = self.get_cached_vcard(who, True) + if cached_vcard and cached_vcard.has_key('PHOTO') and \ + cached_vcard['PHOTO'].has_key('SHA'): + cached_sha = cached_vcard['PHOTO']['SHA'] + else: + cached_sha = '' + if cached_sha != self.vcard_shas[who]: + # avatar has been updated + self.request_vcard(who) + self.vcard_shas[who] = avatar_sha self.dispatch('GC_NOTIFY', (jid_stripped, show, status, resource, prs.getRole(), prs.getAffiliation(), prs.getJid(), prs.getReason(), prs.getActor(), prs.getStatusCode(),