Skip to content
Snippets Groups Projects
Commit 2a5e41e0 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

update groupchat contacts avatar when they change it, and send our presence to...

update groupchat contacts avatar when they change it, and send our presence to groupchat when we change our vcard
parent 0a7e8407
No related branches found
No related tags found
No related merge requests found
......@@ -895,7 +895,6 @@ def _IqCB(self, con, iq_obj):
return
if self.awaiting_answers[id][0] == VCARD_PUBLISHED:
if iq_obj.getType() == 'result':
self.dispatch('VCARD_PUBLISHED', ())
vcard_iq = self.awaiting_answers[id][1]
# Save vcard to HD
if vcard_iq.getTag('PHOTO') and vcard_iq.getTag('PHOTO').getTag('SHA'):
......@@ -918,6 +917,7 @@ def _IqCB(self, con, iq_obj):
show = sshow, status = self.status)
p = self.add_sha(p)
self.connection.send(p)
self.dispatch('VCARD_PUBLISHED', ())
elif iq_obj.getType() == 'error':
self.dispatch('VCARD_NOT_PUBLISHED', ())
elif self.awaiting_answers[id][0] == VCARD_ARRIVED:
......@@ -1415,6 +1415,13 @@ def _presenceCB(self, con, prs):
if gajim.config.get('log_contact_status_changes') and self.name\
not in no_log_for and jid_stripped not in no_log_for:
gajim.logger.write('gcstatus', who, status, show)
if avatar_sha:
if self.vcard_shas.has_key(who):
if avatar_sha != self.vcard_shas[who]:
# avatar has been updated
self.request_vcard(who, True)
else:
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(),
......
......@@ -1293,6 +1293,12 @@ def handle_event_stanza_sent(self, account, stanza):
def handle_event_vcard_published(self, account, array):
dialogs.InformationDialog(_('vCard publication succeeded'), _('Your personal information has been published successfully.'))
for gc_control in self.msg_win_mgr.get_controls(message_control.TYPE_GC):
if gc_control.account == account:
show = gajim.SHOW_LIST[gajim.connections[account].connected]
status = gajim.connections[account].status
gajim.connections[account].send_gc_status(gc_control.nick,
gc_control.room_jid, show, status)
def handle_event_vcard_not_published(self, account, array):
dialogs.InformationDialog(_('vCard publication failed'), _('There was an error while publishing your personal information, try again later.'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment