global option alwaysauth become a per-account autoauth option. Fixes #5264

This commit is contained in:
Yann Leboulanger 2009-09-15 22:26:42 +02:00
parent ebe93d25ff
commit 709dba715a
5 changed files with 16 additions and 6 deletions

View File

@ -1,5 +1,5 @@
AC_INIT([Gajim - A Jabber Instant Messager],
[0.12.5.1-dev],[http://trac.gajim.org/],[gajim])
[0.12.5.2-dev],[http://trac.gajim.org/],[gajim])
AC_PREREQ([2.59])
AC_CONFIG_HEADER(config.h)

View File

@ -67,7 +67,6 @@ class Config:
__options = {
# name: [ type, default_value, help_string ]
'verbose': [ opt_bool, False, '', True ],
'alwaysauth': [ opt_bool, False ],
'autopopup': [ opt_bool, False ],
'notify_on_signin': [ opt_bool, True ],
'notify_on_signout': [ opt_bool, False ],
@ -287,6 +286,7 @@ class Config:
'autoconnect_as': [ opt_str, 'online', _('Status used to autoconnect as. Can be online, chat, away, xa, dnd, invisible. NOTE: this option is used only if restore_last_status is disabled'), True ],
'restore_last_status': [ opt_bool, False, _('If enabled, restore the last status that was used.') ],
'autoreconnect': [ opt_bool, True ],
'autoauth': [ opt_bool, False, _('If True, Contacts requesting authorization will be automatically accepted.')],
'active': [ opt_bool, True],
'proxy': [ opt_str, '', '', True ],
'keyid': [ opt_str, '', '', True ],

View File

@ -2353,13 +2353,14 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
if ptype == 'subscribe':
log.debug('subscribe request from %s' % who)
if gajim.config.get('alwaysauth') or who.find("@") <= 0 or \
jid_stripped in self.jids_for_auto_auth or transport_auto_auth:
if gajim.config.get_per('accounts', self.name, 'autoauth') or \
who.find('@') <= 0 or jid_stripped in self.jids_for_auto_auth or \
transport_auto_auth:
if self.connection:
p = common.xmpp.Presence(who, 'subscribed')
p = self.add_sha(p)
self.connection.send(p)
if who.find("@") <= 0 or transport_auto_auth:
if who.find('@') <= 0 or transport_auto_auth:
self.dispatch('NOTIFY', (jid_stripped, 'offline', 'offline',
resource, prio, keyID, timestamp, None))
if transport_auto_auth:

View File

@ -27,7 +27,7 @@ docdir = '../'
datadir = '../'
localedir = '../po'
version = '0.12.5.1-dev'
version = '0.12.5.2-dev'
import sys, os.path
for base in ('.', 'common'):

View File

@ -202,6 +202,8 @@ class OptionsParser:
self.update_config_to_01231()
if old < [0, 12, 5, 1] and new >= [0, 12, 5, 1]:
self.update_config_to_01251()
if old < [0, 12, 5, 2] and new >= [0, 12, 5, 2]:
self.update_config_to_01252()
gajim.logger.init_vars()
gajim.config.set('version', new_version)
@ -727,4 +729,11 @@ class OptionsParser:
con.close()
gajim.config.set('version', '0.12.5.1')
def update_config_to_01252(self):
if 'alwaysauth' in self.old_values:
val = self.old_values['alwaysauth']
for account in gajim.config.get_per('accounts'):
gajim.config.set_per('accounts', account, 'autoauth', val)
gajim.config.set('version', '0.12.5.2')
# vim: se ts=3: