when we change combobox, only look in global synced accounts if one is connected. Fixes #1724
This commit is contained in:
parent
5677f8c970
commit
a5d95b4792
2 changed files with 14 additions and 4 deletions
|
@ -458,10 +458,13 @@ def get_xmpp_show(show):
|
||||||
return None
|
return None
|
||||||
return show
|
return show
|
||||||
|
|
||||||
def one_account_connected():
|
def one_account_connected(account_list = None):
|
||||||
'''returns True if at least one account is connected, else False'''
|
'''returns True if at least one account is connected, else False'''
|
||||||
|
if account_list is None:
|
||||||
|
accounts = gajim.connections.keys()
|
||||||
|
else:
|
||||||
|
accounts = account_list
|
||||||
one_connected = False
|
one_connected = False
|
||||||
accounts = gajim.connections.keys()
|
|
||||||
for acct in accounts:
|
for acct in accounts:
|
||||||
if gajim.connections[acct].connected > 1:
|
if gajim.connections[acct].connected > 1:
|
||||||
one_connected = True
|
one_connected = True
|
||||||
|
|
|
@ -1850,7 +1850,6 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
self.update_status_combobox()
|
self.update_status_combobox()
|
||||||
return
|
return
|
||||||
status = model[active][2].decode('utf-8')
|
status = model[active][2].decode('utf-8')
|
||||||
one_connected = helpers.one_account_connected()
|
|
||||||
if active == 7: # We choose change status message (7 is that)
|
if active == 7: # We choose change status message (7 is that)
|
||||||
# do not change show, just show change status dialog
|
# do not change show, just show change status dialog
|
||||||
status = model[self.previous_status_combobox_active][2].decode('utf-8')
|
status = model[self.previous_status_combobox_active][2].decode('utf-8')
|
||||||
|
@ -1871,6 +1870,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
# after user chooses "Change status message" menuitem
|
# after user chooses "Change status message" menuitem
|
||||||
# we can return to this show
|
# we can return to this show
|
||||||
self.previous_status_combobox_active = active
|
self.previous_status_combobox_active = active
|
||||||
|
one_connected = helpers.one_account_connected()
|
||||||
if status == 'invisible':
|
if status == 'invisible':
|
||||||
bug_user = False
|
bug_user = False
|
||||||
for acct in accounts:
|
for acct in accounts:
|
||||||
|
@ -1893,12 +1893,19 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
if message is None: # user pressed Cancel to change status message dialog
|
if message is None: # user pressed Cancel to change status message dialog
|
||||||
self.update_status_combobox()
|
self.update_status_combobox()
|
||||||
return
|
return
|
||||||
|
global_sync_accounts = []
|
||||||
|
for acct in accounts:
|
||||||
|
if gajim.config.get_per('accounts', acct, 'sync_with_global_status'):
|
||||||
|
global_sync_accounts.append(acct)
|
||||||
|
one_with_global_sync_connected = helpers.one_account_connected(
|
||||||
|
global_sync_accounts)
|
||||||
for acct in accounts:
|
for acct in accounts:
|
||||||
if not gajim.config.get_per('accounts', acct, 'sync_with_global_status'):
|
if not gajim.config.get_per('accounts', acct, 'sync_with_global_status'):
|
||||||
continue
|
continue
|
||||||
# we are connected (so we wanna change show and status)
|
# we are connected (so we wanna change show and status)
|
||||||
# or no account is connected and we want to connect with new show and status
|
# or no account is connected and we want to connect with new show and status
|
||||||
if not one_connected or gajim.connections[acct].connected > 1:
|
if not one_with_global_sync_connected or \
|
||||||
|
gajim.connections[acct].connected > 1:
|
||||||
self.send_status(acct, status, message)
|
self.send_status(acct, status, message)
|
||||||
self.update_status_combobox()
|
self.update_status_combobox()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue