keep nickname and group when we re-ask auth. fixes #2741

This commit is contained in:
Yann Leboulanger 2006-12-10 14:18:31 +00:00
parent f5e5a208ed
commit bd2f62ab0d
2 changed files with 11 additions and 14 deletions

View File

@ -641,7 +641,7 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
group = self.group_comboboxentry.child.get_text().decode('utf-8') group = self.group_comboboxentry.child.get_text().decode('utf-8')
auto_auth = self.auto_authorize_checkbutton.get_active() auto_auth = self.auto_authorize_checkbutton.get_active()
gajim.interface.roster.req_sub(self, jid, message, self.account, gajim.interface.roster.req_sub(self, jid, message, self.account,
group = group, pseudo = nickname, auto_auth = auto_auth) groups = [group], nickname = nickname, auto_auth = auto_auth)
self.window.destroy() self.window.destroy()
def on_protocol_combobox_changed(self, widget): def on_protocol_combobox_changed(self, widget):

View File

@ -1843,7 +1843,8 @@ class RosterWindow:
self.on_add_special_notification_menuitem_activate, jid) self.on_add_special_notification_menuitem_activate, jid)
else: else:
ask_auth_menuitem.connect('activate', self.req_sub, jid, ask_auth_menuitem.connect('activate', self.req_sub, jid,
_('I would like to add you to my roster'), account) _('I would like to add you to my roster'), account,
contact.groups, contact.name)
if contact.sub in ('to', 'none'): if contact.sub in ('to', 'none'):
revoke_auth_menuitem.set_sensitive(False) revoke_auth_menuitem.set_sensitive(False)
else: else:
@ -2375,15 +2376,11 @@ class RosterWindow:
dialogs.InformationDialog(_('Authorization has been sent'), dialogs.InformationDialog(_('Authorization has been sent'),
_('Now "%s" will know your status.') %jid) _('Now "%s" will know your status.') %jid)
def req_sub(self, widget, jid, txt, account, group = None, pseudo = None, def req_sub(self, widget, jid, txt, account, groups = [], nickname = None,
auto_auth = False): auto_auth = False):
'''Request subscription to a contact''' '''Request subscription to a contact'''
if group: gajim.connections[account].request_subscription(jid, txt, nickname,
group = [group] groups, auto_auth, gajim.nicks[account])
else:
group = []
gajim.connections[account].request_subscription(jid, txt, pseudo, group,
auto_auth, gajim.nicks[account])
contact = gajim.contacts.get_contact_with_highest_priority(account, jid) contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
if not contact: if not contact:
keyID = '' keyID = ''
@ -2391,8 +2388,8 @@ class RosterWindow:
'attached_gpg_keys').split() 'attached_gpg_keys').split()
if jid in attached_keys: if jid in attached_keys:
keyID = attached_keys[attached_keys.index(jid) + 1] keyID = attached_keys[attached_keys.index(jid) + 1]
contact = gajim.contacts.create_contact(jid = jid, name = pseudo, contact = gajim.contacts.create_contact(jid = jid, name = nickname,
groups = group, show = 'requested', status = '', ask = 'none', groups = groups, show = 'requested', status = '', ask = 'none',
sub = 'subscribe', keyID = keyID) sub = 'subscribe', keyID = keyID)
gajim.contacts.add_contact(account, contact) gajim.contacts.add_contact(account, contact)
else: else:
@ -2401,9 +2398,9 @@ class RosterWindow:
_('If "%s" accepts this request you will know his or her status.' _('If "%s" accepts this request you will know his or her status.'
) % jid) ) % jid)
return return
contact.groups = group contact.groups = groups
if pseudo: if nickname:
contact.name = pseudo contact.name = nickname
self.remove_contact(contact, account) self.remove_contact(contact, account)
self.add_contact_to_roster(jid, account) self.add_contact_to_roster(jid, account)