add autoconnect_as feature to autoconnect as away or invisible
This commit is contained in:
parent
1c313ed242
commit
a6e06b3bca
|
@ -274,6 +274,7 @@ class Config:
|
||||||
'autopriority_dnd': [ opt_int, 20],
|
'autopriority_dnd': [ opt_int, 20],
|
||||||
'autopriority_invisible': [ opt_int, 10],
|
'autopriority_invisible': [ opt_int, 10],
|
||||||
'autoconnect': [ opt_bool, False, '', True ],
|
'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 ],
|
'autoreconnect': [ opt_bool, True ],
|
||||||
'active': [ opt_bool, True],
|
'active': [ opt_bool, True],
|
||||||
'proxy': [ opt_str, '', '', True ],
|
'proxy': [ opt_str, '', '', True ],
|
||||||
|
|
22
src/gajim.py
22
src/gajim.py
|
@ -2370,18 +2370,24 @@ class Interface:
|
||||||
|
|
||||||
def autoconnect(self):
|
def autoconnect(self):
|
||||||
'''auto connect at startup'''
|
'''auto connect at startup'''
|
||||||
ask_message = False
|
# dict of account that want to connect sorted by status
|
||||||
|
shows = {}
|
||||||
for a in gajim.connections:
|
for a in gajim.connections:
|
||||||
if gajim.config.get_per('accounts', a, 'autoconnect'):
|
if gajim.config.get_per('accounts', a, 'autoconnect'):
|
||||||
ask_message = True
|
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)
|
||||||
break
|
break
|
||||||
if ask_message:
|
for show in shows:
|
||||||
message = self.roster.get_status_message('online')
|
message = self.roster.get_status_message(show)
|
||||||
if message == None:
|
if message == None:
|
||||||
return
|
continue
|
||||||
for a in gajim.connections:
|
for a in shows[show]:
|
||||||
if gajim.config.get_per('accounts', a, 'autoconnect'):
|
self.roster.send_status(a, show, message)
|
||||||
self.roster.send_status(a, 'online', message)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def show_systray(self):
|
def show_systray(self):
|
||||||
|
|
Loading…
Reference in New Issue