show a correct vcard when it's the one of a contact that request our subscription. Fixes #1524

This commit is contained in:
Yann Leboulanger 2006-02-20 21:30:45 +00:00
parent aa3ce4dd86
commit 9fe2475eba
2 changed files with 13 additions and 9 deletions

View File

@ -678,15 +678,14 @@ class SubscriptionRequestWindow:
if gajim.interface.instances[self.account]['infos'].has_key(self.jid): if gajim.interface.instances[self.account]['infos'].has_key(self.jid):
gajim.interface.instances[self.account]['infos'][self.jid].window.present() gajim.interface.instances[self.account]['infos'][self.jid].window.present()
else: else:
contact = gajim.contacts.create_contact(jid = self.jid, name='',
groups=[], show='', status='', sub='', ask='', resource='',
priority=5, keyID='', our_chatstate=None, chatstate=None)
gajim.interface.instances[self.account]['infos'][self.jid] = \ gajim.interface.instances[self.account]['infos'][self.jid] = \
vcard.VcardWindow(self.jid, self.account, True) vcard.VcardWindow(contact, self.account)
#remove the publish / retrieve buttons # Remove jabber page
vcard_xml = gajim.interface.instances[self.account]['infos'][self.jid].xml gajim.interface.instances[self.account]['infos'][self.jid].xml.\
hbuttonbox = vcard_xml.get_widget('information_hbuttonbox') get_widget('information_notebook').remove_page(0)
children = hbuttonbox.get_children()
hbuttonbox.remove(children[0])
hbuttonbox.remove(children[1])
vcard_xml.get_widget('nickname_label').set_text(self.jid)
gajim.connections[self.account].request_vcard(self.jid) gajim.connections[self.account].request_vcard(self.jid)
def on_deny_button_clicked(self, widget): def on_deny_button_clicked(self, widget):

View File

@ -88,7 +88,7 @@ class VcardWindow:
self.publish_button.set_no_show_all(True) self.publish_button.set_no_show_all(True)
self.retrieve_button.set_no_show_all(True) self.retrieve_button.set_no_show_all(True)
self.contact = contact #don't use it if vcard is true self.contact = contact # don't use it if vcard is true
self.account = account self.account = account
self.vcard = vcard self.vcard = vcard
self.avatar_mime_type = None self.avatar_mime_type = None
@ -137,6 +137,11 @@ class VcardWindow:
return return
# update contact.name if it's not '' # update contact.name if it's not ''
name_entry = self.xml.get_widget('nickname_entry') name_entry = self.xml.get_widget('nickname_entry')
if not name_entry:
# This can happen when we don't show jabber page. For exemple when we
# show the vcard of a contact that request our subscription
self.window.destroy()
return
new_name = name_entry.get_text().decode('utf-8') new_name = name_entry.get_text().decode('utf-8')
if new_name != self.contact.name and new_name != '': if new_name != self.contact.name and new_name != '':
self.contact.name = new_name self.contact.name = new_name