fix adjust_priority_with_status option: save when we change this option and correctly get autopriority_* values

This commit is contained in:
Yann Leboulanger 2006-10-08 09:01:32 +00:00
parent 5af35ccb2e
commit 182963242b
2 changed files with 9 additions and 8 deletions

View File

@ -120,10 +120,6 @@ status_before_autoaway = {}
SHOW_LIST = ['offline', 'connecting', 'online', 'chat', 'away', 'xa', 'dnd',
'invisible']
priority_dict = {}
for status in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'):
priority_dict[status] = config.get('autopriority' + status)
def get_nick_from_jid(jid):
pos = jid.find('@')
return jid[:pos]
@ -333,7 +329,9 @@ def get_priority(account, show):
'''return the priority an account must have'''
if not show:
show = 'online'
if show in priority_dict and config.get_per('accounts', account,
'adjust_priority_with_status'):
return priority_dict[show]
if show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible') and \
config.get_per('accounts', account, 'adjust_priority_with_status'):
return config.get_per('accounts', account, 'autopriority_' + show)
print '1', config.get_per('accounts', account, 'priority')
return config.get_per('accounts', account, 'priority')

View File

@ -1324,6 +1324,8 @@ class AccountModificationWindow:
config['password'] = self.xml.get_widget('password_entry').get_text().\
decode('utf-8')
config['resource'] = resource
config['adjust_priority_with_status'] = self.xml.get_widget(
'adjust_priority_with_status_checkbutton').get_active()
config['priority'] = self.xml.get_widget('priority_spinbutton').\
get_value_as_int()
config['autoconnect'] = self.xml.get_widget('autoconnect_checkbutton').\
@ -1451,7 +1453,8 @@ class AccountModificationWindow:
config['use_ft_proxies']:
gajim.connections[self.account].discover_ft_proxies()
if self.option_changed(config, 'priority'):
if self.option_changed(config, 'priority') or self.option_changed(
config, 'adjust_priority_with_status'):
resend_presence = True
for opt in config: