| | 911 | gc_c = gajim.contacts.get_gc_contact(self.account, self.room_jid, |
| | 912 | nick) |
| | 913 | # Re-get vcard if avatar has changed |
| | 914 | # We do that here because we may request it to the real JID if we |
| | 915 | # knows it. connections.py doesn't know it. |
| | 916 | con = gajim.connections[self.account] |
| | 917 | if gc_c.jid: |
| | 918 | real_jid = gc_c.jid |
| | 919 | if gc_c.resource: |
| | 920 | real_jid += '/' + gc_c.resource |
| | 921 | else: |
| | 922 | real_jid = fake_jid |
| | 923 | if con.vcard_shas.has_key(fake_jid): |
| | 924 | if avatar_sha != con.vcard_shas[fake_jid]: |
| | 925 | server = gajim.get_server_from_jid(self.room_jid) |
| | 926 | if not server.startswith('irc'): |
| | 927 | con.request_vcard(real_jid, fake_jid) |
| | 928 | else: |
| | 929 | cached_vcard = con.get_cached_vcard(fake_jid, True) |
| | 930 | if cached_vcard and cached_vcard.has_key('PHOTO') and \ |
| | 931 | cached_vcard['PHOTO'].has_key('SHA'): |
| | 932 | cached_sha = cached_vcard['PHOTO']['SHA'] |
| | 933 | else: |
| | 934 | cached_sha = '' |
| | 935 | if cached_sha != avatar_sha: |
| | 936 | # avatar has been updated |
| | 937 | # sha in mem will be updated later |
| | 938 | server = gajim.get_server_from_jid(self.room_jid) |
| | 939 | if not server.startswith('irc'): |
| | 940 | con.request_vcard(real_jid, fake_jid) |
| | 941 | else: |
| | 942 | # save sha in mem NOW |
| | 943 | con.vcard_shas[fake_jid] = avatar_sha |
| | 944 | |