From 3c2ba42a7e674caad5803bdb39ef745b9af1ba28 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sat, 8 Jan 2005 00:19:40 +0000 Subject: [PATCH] we can now save password in password_window --- plugins/gtkgui/dialogs.py | 6 ++++-- plugins/gtkgui/gtkgui.glade | 19 +++++++++++++++++++ plugins/gtkgui/gtkgui.py | 14 ++++++++++---- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/plugins/gtkgui/dialogs.py b/plugins/gtkgui/dialogs.py index 70e20cb22..16ffaf040 100644 --- a/plugins/gtkgui/dialogs.py +++ b/plugins/gtkgui/dialogs.py @@ -221,8 +221,9 @@ class passphrase_Window: msg = self.entry.get_text() else: msg = -1 + chk = self.xml.get_widget("save_checkbutton") self.win.destroy() - return msg + return msg, chk.get_active() def on_key_pressed(self, widget, event): if event.keyval == gtk.keysyms.Return: @@ -242,8 +243,9 @@ class passphrase_Window: def get_pass(self): self.autoconnect = 0 + chk = self.xml.get_widget("save_checkbutton") self.win.destroy() - return self.msg + return self.msg, chk.get_active() def delete_event(self, widget=None): """close window""" diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade index 016d23195..4409f5581 100644 --- a/plugins/gtkgui/gtkgui.glade +++ b/plugins/gtkgui/gtkgui.glade @@ -8563,6 +8563,25 @@ on the server. False + + + + True + True + Save password ? + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + 0 diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index 136ca96bb..0892de717 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -1392,12 +1392,15 @@ class roster_Window: w = passphrase_Window('Enter your password for your account %s' % account, autoconnect) if autoconnect: gtk.main() - passphrase = w.get_pass() + passphrase, save = w.get_pass() else: - passphrase = w.run() + passphrase, save = w.run() if passphrase == -1: return self.plugin.send('PASSPHRASE', account, passphrase) + if save: + self.plugin.accounts[account]['savepass'] = 1 + self.plugin.accounts[account]['password'] = passphrase keyid = None save_gpg_pass = 0 @@ -1414,11 +1417,14 @@ class roster_Window: w = passphrase_Window('Enter your passphrase for your the GPG key of your account %s' % account, autoconnect) if autoconnect: gtk.main() - passphrase = w.get_pass() + passphrase, save = w.get_pass() else: - passphrase = w.run() + passphrase, save = w.run() if passphrase == -1: passphrase = '' + if save: + self.plugin.accounts[account]['savegpgpass'] = 1 + self.plugin.accounts[account]['gpgpassword'] = passphrase self.plugin.send('GPGPASSPHRASE', account, passphrase) self.plugin.send('STATUS', account, (status, txt)) if status == 'online' and self.plugin.sleeper.getState() != \