Keep last status on autoconnect.

This commit is contained in:
js 2008-07-16 15:50:51 +00:00
parent 4dbf5d9c0e
commit 1fabaa8844
3 changed files with 12 additions and 15 deletions

View File

@ -270,7 +270,6 @@ class Config:
'autopriority_dnd': [ opt_int, 20],
'autopriority_invisible': [ opt_int, 10],
'autoconnect': [ opt_bool, False, '', True ],
'autoconnect_as': [ opt_str, 'online', _('Status used to autoconnect as. Can be online, chat, away, xa, dnd, invisible.'), True ],
'autoreconnect': [ opt_bool, True ],
'active': [ opt_bool, True],
'proxy': [ opt_str, '', '', True ],
@ -308,6 +307,8 @@ class Config:
'msgwin-height': [opt_int, 440],
'listen_to_network_manager' : [opt_bool, True],
'is_zeroconf': [opt_bool, False],
'last_status': [opt_str, 'online'],
'last_status_msg': [opt_str, ''],
'zeroconf_first_name': [ opt_str, '', '', True ],
'zeroconf_last_name': [ opt_str, '', '', True ],
'zeroconf_jabber_id': [ opt_str, '', '', True ],

View File

@ -2706,22 +2706,13 @@ 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'):
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:
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)
self.roster.send_status(a,
gajim.config.get_per('accounts', a,
'last_status'),
gajim.config.get_per('accounts', a,
'last_status_msg'))
return False
def show_systray(self):

View File

@ -1726,6 +1726,11 @@ class RosterWindow:
def send_status(self, account, status, txt, auto = False, to = None):
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', txt)
if gajim.connections[account].connected < 2:
self.set_connecting_state(account)