send new presence to correct account in account modification window. Fixes #4313

This commit is contained in:
Yann Leboulanger 2008-09-15 15:30:45 +00:00
parent 85d5748800
commit 8c381dee81
1 changed files with 16 additions and 17 deletions

View File

@ -1361,10 +1361,10 @@ class AccountsWindow:
iter = model.append() iter = model.append()
model.set(iter, 0, account) model.set(iter, 0, account)
def resend(self): def resend(self, account):
show = gajim.SHOW_LIST[gajim.connections[self.current_account].connected] show = gajim.SHOW_LIST[gajim.connections[account].connected]
status = gajim.connections[self.current_account].status status = gajim.connections[account].status
gajim.connections[self.current_account].change_status(show, status) gajim.connections[account].change_status(show, status)
def check_resend_relog(self): def check_resend_relog(self):
if self.need_relogin and self.current_account == gajim.ZEROCONF_ACC_NAME: if self.need_relogin and self.current_account == gajim.ZEROCONF_ACC_NAME:
@ -1382,26 +1382,25 @@ class AccountsWindow:
gajim.interface.roster.send_status(account, show_before, gajim.interface.roster.send_status(account, show_before,
status_before) status_before)
def relog(): def relog(account):
self.dialog.destroy() self.dialog.destroy()
show_before = gajim.SHOW_LIST[gajim.connections[ show_before = gajim.SHOW_LIST[gajim.connections[account].connected]
self.current_account].connected] status_before = gajim.connections[account].status
status_before = gajim.connections[self.current_account].status gajim.interface.roster.send_status(account, 'offline',
gajim.interface.roster.send_status(self.current_account, 'offline',
_('Be right back.')) _('Be right back.'))
gobject.timeout_add(500, login, self.current_account, show_before, gobject.timeout_add(500, login, account, show_before, status_before)
status_before)
def on_yes(checked): def on_yes(checked, account):
relog() relog(account)
def on_no(): def on_no(account):
if self.resend_presence: if self.resend_presence:
self.resend() self.resend(account)
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=on_yes, on_response_no=on_no) 'you must relogin.'), on_response_yes=(on_yes,
self.current_account), on_response_no=(on_no, self.current_account))
elif self.resend_presence: elif self.resend_presence:
self.resend() self.resend(self.current_account)
self.need_relogin = False self.need_relogin = False
self.resend_presence = False self.resend_presence = False