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):
gajim.interface.instances[self.account]['infos'][self.jid].window.present()
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] = \
vcard.VcardWindow(self.jid, self.account, True)
#remove the publish / retrieve buttons
vcard_xml = gajim.interface.instances[self.account]['infos'][self.jid].xml
hbuttonbox = vcard_xml.get_widget('information_hbuttonbox')
children = hbuttonbox.get_children()
hbuttonbox.remove(children[0])
hbuttonbox.remove(children[1])
vcard_xml.get_widget('nickname_label').set_text(self.jid)
vcard.VcardWindow(contact, self.account)
# Remove jabber page
gajim.interface.instances[self.account]['infos'][self.jid].xml.\
get_widget('information_notebook').remove_page(0)
gajim.connections[self.account].request_vcard(self.jid)
def on_deny_button_clicked(self, widget):

View File

@ -137,6 +137,11 @@ class VcardWindow:
return
# update contact.name if it's not ''
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')
if new_name != self.contact.name and new_name != '':
self.contact.name = new_name