restore autoconnect_as option. Correctly use 80 char width

This commit is contained in:
Yann Leboulanger 2008-07-29 06:42:34 +00:00
parent 49ea574c7d
commit 676b91731d
3 changed files with 22 additions and 14 deletions

View File

@ -277,7 +277,8 @@ class Config:
'autopriority_dnd': [ opt_int, 20],
'autopriority_invisible': [ opt_int, 10],
'autoconnect': [ opt_bool, False, '', True ],
'dont_restore_last_status': [ opt_bool, False, _('If enabled, don\'t restore the last status that was used.') ],
'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 ],
'active': [ opt_bool, True],
'proxy': [ opt_str, '', '', True ],

View File

@ -2775,18 +2775,27 @@ class Interface:
def autoconnect(self):
'''auto connect at startup'''
# dict of account that want to connect sorted by status
shows = {}
for a in gajim.connections:
if gajim.config.get_per('accounts', a, 'autoconnect'):
if not gajim.config.get_per('accounts', a,
'dont_restore_last_status'):
self.roster.send_status(a,
gajim.config.get_per('accounts',
a, 'last_status'),
helpers.from_one_line(
gajim.config.get_per('accounts',
a, 'last_status_msg')))
if gajim.config.get_per('accounts', a, 'restore_last_status'):
self.roster.send_status(a, gajim.config.get_per('accounts', a,
'last_status'), helpers.from_one_line(gajim.config.get_per(
'accounts', a, 'last_status_msg')))
continue
show = gajim.config.get_per('accounts', a, 'autoconnect_as')
if not show in gajim.SHOW_LIST:
continue
if not show in shows:
shows[show] = [a]
else:
self.roster.send_status(a, 'online', '')
shows[show].append(a)
for show in shows:
message = self.roster.get_status_message(show)
if message is None:
continue
for a in shows[show]:
self.roster.send_status(a, show, message)
return False
def show_systray(self):

View File

@ -1936,10 +1936,8 @@ class RosterWindow:
child_iterA = self._get_account_iter(account, self.model)
if status != 'offline':
if to is None:
gajim.config.set_per('accounts', account,
'last_status', status)
gajim.config.set_per('accounts', account,
'last_status_msg',
gajim.config.set_per('accounts', account, 'last_status', status)
gajim.config.set_per('accounts', account, 'last_status_msg',
helpers.to_one_line(txt))
if gajim.connections[account].connected < 2:
self.set_connecting_state(account)