don't close all GPG passphrase request dialogs when an account goes offline. Fixes #5938

This commit is contained in:
Yann Leboulanger 2010-10-04 21:46:39 +02:00
parent 4bf5a3712e
commit c961463f10
1 changed files with 10 additions and 4 deletions

View File

@ -225,7 +225,7 @@ class Interface:
del self.instances[account]['online_dialog'][name] del self.instances[account]['online_dialog'][name]
for request in self.gpg_passphrase.values(): for request in self.gpg_passphrase.values():
if request: if request:
request.interrupt() request.interrupt(account=account)
if account in self.pass_dialog: if account in self.pass_dialog:
self.pass_dialog[account].window.destroy() self.pass_dialog[account].window.destroy()
if show == 'offline': if show == 'offline':
@ -3373,9 +3373,15 @@ class PassphraseRequest:
self.passphrase = None self.passphrase = None
self.completed = False self.completed = False
def interrupt(self): def interrupt(self, account=None):
self.dialog.window.destroy() if account:
self.callbacks = [] for (acct, cb) in self.callbacks:
if acct == account:
self.callbacks.remove((acct, cb))
else:
self.callbacks = []
if not len(self.callbacks):
self.dialog.window.destroy()
def run_callback(self, account, callback): def run_callback(self, account, callback):
gajim.connections[account].gpg_passphrase(self.passphrase) gajim.connections[account].gpg_passphrase(self.passphrase)