Keep last status on autoconnect.
This commit is contained in:
parent
4dbf5d9c0e
commit
1fabaa8844
|
@ -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 ],
|
||||
|
|
19
src/gajim.py
19
src/gajim.py
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue