auto_authorization is now keept in mem. This way it works correctly, but doesn't if you close gajim before your contact ask your auth. Fixes #1630

This commit is contained in:
Yann Leboulanger 2006-03-08 10:46:36 +00:00
parent 119c5ed55f
commit d4cbe39fc2
3 changed files with 13 additions and 7 deletions

View File

@ -204,6 +204,7 @@ class Connection:
HAS_IDLE = False
self.on_connect_success = None
self.retrycount = 0
self.auto_auth = [] # list of jid to auto-authorize
# END __init__
def get_full_jid(self, iq_obj):
@ -565,7 +566,8 @@ class Connection:
if ptype == 'subscribe':
gajim.log.debug('subscribe request from %s' % who)
if gajim.config.get('alwaysauth') or who.find("@") <= 0:
if gajim.config.get('alwaysauth') or who.find("@") <= 0 or \
jid_stripped in self.auto_auth:
if self.connection:
p = common.xmpp.Presence(who, 'subscribed')
p = self.add_sha(p)
@ -2198,10 +2200,13 @@ class Connection:
p = common.xmpp.Presence(jid, 'unsubscribe')
self.connection.send(p)
def request_subscription(self, jid, msg, name = '', groups = []):
def request_subscription(self, jid, msg, name = '', groups = [],
auto_auth = False):
if not self.connection:
return
gajim.log.debug('subscription request for %s' % jid)
if auto_auth:
self.auto_auth.append(jid)
# RFC 3921 section 8.2
infos = {'jid': jid}
if name:

View File

@ -416,10 +416,9 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
end_iter = message_buffer.get_end_iter()
message = message_buffer.get_text(start_iter, end_iter).decode('utf-8')
group = self.group_comboboxentry.child.get_text().decode('utf-8')
auto_auth = self.xml.get_widget('auto_authorize_checkbutton').get_active()
gajim.interface.roster.req_sub(self, jid, message, self.account,
group = group, pseudo = nickname)
if self.xml.get_widget('auto_authorize_checkbutton').get_active():
gajim.connections[self.account].send_authorization(jid)
group = group, pseudo = nickname, auto_auth = auto_auth)
self.window.destroy()
def fill_jid(self):

View File

@ -1398,13 +1398,15 @@ class RosterWindow:
dialogs.InformationDialog(_('Authorization has been sent'),
_('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, group = None, pseudo = None,
auto_auth = False):
'''Request subscription to a contact'''
if group:
group = [group]
else:
group = []
gajim.connections[account].request_subscription(jid, txt, pseudo, group)
gajim.connections[account].request_subscription(jid, txt, pseudo, group,
auto_auth)
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
if not contact:
keyID = ''