changing prio doesn't require relog, just resend presence. changing resource needs relogin. Fixes #1836

This commit is contained in:
Yann Leboulanger 2006-04-23 19:29:02 +00:00
parent 7e190cd107
commit 7ae0998c9b
1 changed files with 22 additions and 2 deletions

View File

@ -1290,12 +1290,13 @@ class AccountModificationWindow:
gajim.config.add_per('accounts', name) gajim.config.add_per('accounts', name)
self.account = name self.account = name
resend_presence = False
if gajim.connections[self.account].connected == 0: # we're disconnected if gajim.connections[self.account].connected == 0: # we're disconnected
relogin_needed = False relogin_needed = False
else: # we're connected to the account we want to apply changes else: # we're connected to the account we want to apply changes
# check if relogin is needed # check if relogin is needed
relogin_needed = self.options_changed_need_relogin(config, relogin_needed = self.options_changed_need_relogin(config,
('priority', 'proxy', 'usessl', 'keyname', ('resource', 'proxy', 'usessl', 'keyname',
'use_custom_host', 'custom_host')) 'use_custom_host', 'custom_host'))
if config['use_custom_host'] and (self.option_changed(config, if config['use_custom_host'] and (self.option_changed(config,
@ -1306,6 +1307,9 @@ class AccountModificationWindow:
config['use_ft_proxies']: config['use_ft_proxies']:
gajim.connections[self.account].discover_ft_proxies() gajim.connections[self.account].discover_ft_proxies()
if self.option_changed(config, 'priority'):
resend_presence = True
for opt in config: for opt in config:
gajim.config.set_per('accounts', name, opt, config[opt]) gajim.config.set_per('accounts', name, opt, config[opt])
if config['savepass']: if config['savepass']:
@ -1328,6 +1332,7 @@ class AccountModificationWindow:
gajim.connections[account].disconnect(True) gajim.connections[account].disconnect(True)
gajim.interface.roster.send_status(account, show_before, gajim.interface.roster.send_status(account, show_before,
status_before) status_before)
def relog(widget): def relog(widget):
self.dialog.destroy() self.dialog.destroy()
show_before = gajim.SHOW_LIST[gajim.connections[self.account].\ show_before = gajim.SHOW_LIST[gajim.connections[self.account].\
@ -1337,9 +1342,24 @@ class AccountModificationWindow:
_('Be right back.')) _('Be right back.'))
gobject.timeout_add(500, login, self.account, show_before, gobject.timeout_add(500, login, self.account, show_before,
status_before) status_before)
def resend(widget):
self.resend_presence()
on_no = None
if resend_presence:
on_no = resend
self.dialog = dialogs.YesNoDialog(_('Relogin now?'), self.dialog = dialogs.YesNoDialog(_('Relogin now?'),
_('If you want all the changes to apply instantly, ' _('If you want all the changes to apply instantly, '
'you must relogin.'), on_response_yes = relog) 'you must relogin.'), on_response_yes = relog,
on_response_no = on_no)
elif resend_presence:
self.resend_presence()
def resend_presence(self):
show = gajim.SHOW_LIST[gajim.connections[self.account].connected]
status = gajim.connections[self.account].status
gajim.connections[self.account].change_status(show, status)
def on_change_password_button_clicked(self, widget): def on_change_password_button_clicked(self, widget):
try: try: