diff --git a/core/core.py b/core/core.py
index 769e02fed..49a59e71b 100644
--- a/core/core.py
+++ b/core/core.py
@@ -224,11 +224,13 @@ class GajimCore:
#connexions {con: name, ...}
self.connexions = {}
self.gpg = {}
+ self.passwords = {}
if USE_GPG:
self.gpg_common = MyGnuPG()
for a in self.accounts:
self.connected[a] = 0 #0:offline, 1:online, 2:away,
#3:xa, 4:dnd, 5:invisible
+ self.passwords[a] = self.cfgParser.tab[a]["password"]
if USE_GPG:
self.gpg[a] = MyGnuPG()
self.myVCardID = []
@@ -271,7 +273,6 @@ class GajimCore:
'localhost', 'port': 8255, 'modules': 'gtkgui'}}
fname = os.path.expanduser(CONFPATH)
reps = string.split(fname, '/')
-# del reps[0]
path = ''
while len(reps) > 1:
path = path + reps[0] + '/'
@@ -482,7 +483,7 @@ class GajimCore:
"""Connect and authentificate to the Jabber server"""
hostname = self.cfgParser.tab[account]["hostname"]
name = self.cfgParser.tab[account]["name"]
- password = self.cfgParser.tab[account]["password"]
+ password = self.passwords[account]
ressource = self.cfgParser.tab[account]["ressource"]
#create connexion if it doesn't already existe
@@ -811,7 +812,9 @@ class GajimCore:
#('ACC_CHG', old_account, new_account)
elif ev[0] == 'ACC_CHG':
self.connected[ev[2]] = self.connected[ev[1]]
+ self.passwords[ev[2]] = self.passwords[ev[1]]
del self.connected[ev[1]]
+ del self.passwords[ev[1]]
if USE_GPG:
self.gpg[ev[2]] = self.gpg[ev[1]]
del self.gpg[ev[1]]
@@ -892,14 +895,16 @@ class GajimCore:
else:
con.send(common.jabber.Presence('%s/%s' % (ev[2][1], ev[2][0]), \
'available', show=ev[2][2], status = ev[2][3]))
- #('PASSPHRASE', account, passphrase)
- elif ev[0] == 'PASSPHRASE':
+ #('GPGPASSPHRASE', account, passphrase)
+ elif ev[0] == 'GPGPASSPHRASE':
if USE_GPG:
self.gpg[ev[1]].passphrase = ev[2]
elif ev[0] == 'GPG_SECRETE_KEYS':
if USE_GPG:
keys = self.gpg_common.get_secret_keys()
self.hub.sendPlugin('GPG_SECRETE_KEYS', ev[1], keys)
+ elif ev[0] == 'PASSPHRASE':
+ self.passwords[ev[1]] = ev[2]
else:
log.debug(_("Unknown Command %s") % ev[0])
if self.mode == 'server':
diff --git a/plugins/gtkgui/config.py b/plugins/gtkgui/config.py
index 3dbb81f9e..219191ffa 100644
--- a/plugins/gtkgui/config.py
+++ b/plugins/gtkgui/config.py
@@ -264,6 +264,10 @@ class preference_Window:
self.write_cfg()
self.xml.get_widget('Preferences').destroy()
+ def on_apply(self, widget):
+ """When Apply button is clicked"""
+ self.write_cfg()
+
def change_notebook_page(self, number):
self.notebook.set_current_page(number)
@@ -319,6 +323,11 @@ class preference_Window:
first_iter, end_iter = buf.get_bounds()
name = model.get_value(iter, 0)
model.set_value(iter, 1, buf.get_text(first_iter, end_iter))
+
+ def on_chk_toggled(self, widget, widgets):
+ """set or unset sensitivity of widgets when widget is toggled"""
+ for w in widgets:
+ w.set_sensitive(widget.get_active())
def __init__(self, plugin):
"""Initialize Preference window"""
@@ -380,6 +389,7 @@ class preference_Window:
#Autopopupaway
st = self.plugin.config['autopopupaway']
self.chk_autoppaway.set_active(st)
+ self.chk_autoppaway.set_sensitive(self.plugin.config['autopopup'])
#Autoaway
st = self.plugin.config['autoaway']
@@ -388,6 +398,7 @@ class preference_Window:
#Autoawaytime
st = self.plugin.config['autoawaytime']
self.spin_autoawaytime.set_value(st)
+ self.spin_autoawaytime.set_sensitive(self.plugin.config['autoaway'])
#Autoxa
st = self.plugin.config['autoxa']
@@ -396,6 +407,7 @@ class preference_Window:
#Autoxatime
st = self.plugin.config['autoxatime']
self.spin_autoxatime.set_value(st)
+ self.spin_autoxatime.set_sensitive(self.plugin.config['autoxa'])
#Status messages
self.msg_tree = self.xml.get_widget('msg_treeview')
@@ -461,6 +473,7 @@ class preference_Window:
self.xml.get_widget('fontbutton_user_text').set_font_name(fontStr)
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
+ self.xml.signal_connect('on_apply_clicked', self.on_apply)
self.xml.signal_connect('on_ok_clicked', self.on_ok)
self.xml.signal_connect('on_cancel_clicked', self.on_cancel)
self.xml.signal_connect('on_msg_treeview_cursor_changed', \
@@ -469,6 +482,12 @@ class preference_Window:
self.on_new_msg_button_clicked)
self.xml.signal_connect('on_delete_msg_button_clicked', \
self.on_delete_msg_button_clicked)
+ self.xml.signal_connect('on_chk_autopopup_toggled', \
+ self.on_chk_toggled, [self.chk_autoppaway])
+ self.xml.signal_connect('on_chk_autoaway_toggled', \
+ self.on_chk_toggled, [self.spin_autoawaytime])
+ self.xml.signal_connect('on_chk_autoxa_toggled', \
+ self.on_chk_toggled, [self.spin_autoxatime])
class accountPreference_Window:
"""Class for account informations"""
@@ -489,8 +508,13 @@ class accountPreference_Window:
self.xml.get_widget("entry_name").set_text(infos['accname'])
if infos.has_key('jid'):
self.xml.get_widget("entry_jid").set_text(infos['jid'])
- if infos.has_key('password'):
- self.xml.get_widget("entry_password").set_text(infos['password'])
+ if infos.has_key('savepass'):
+ self.xml.get_widget('chk_password').set_active(\
+ infos['savepass'])
+ if infos['savepass']:
+ self.xml.get_widget('entry_password').set_sensitive(True)
+ if infos.has_key('password'):
+ self.xml.get_widget("entry_password").set_text(infos['password'])
if infos.has_key('ressource'):
self.xml.get_widget("entry_ressource").set_text(infos['ressource'])
if infos.has_key('priority'):
@@ -519,9 +543,15 @@ class accountPreference_Window:
if infos.has_key('gpgpass'):
self.xml.get_widget('gpg_pass_entry').set_text(\
infos['gpgpass'])
+ if infos.has_key('autoconnect'):
+ self.xml.get_widget('chk_autoconnect').set_active(\
+ infos['autoconnect'])
def on_save_clicked(self, widget):
"""When save button is clicked : Save informations in config file"""
+ savepass = 0
+ if self.xml.get_widget("chk_password").get_active():
+ savepass = 1
entryPass = self.xml.get_widget("entry_password")
entryRessource = self.xml.get_widget("entry_ressource")
entryPriority = self.xml.get_widget("entry_priority")
@@ -529,6 +559,9 @@ class accountPreference_Window:
check = self.xml.get_widget("checkbutton")
entryName = self.xml.get_widget("entry_name")
entryJid = self.xml.get_widget("entry_jid")
+ autoconnect = 0
+ if self.xml.get_widget("chk_autoconnect").get_active():
+ autoconnect = 1
checkProxy = self.xml.get_widget("checkbutton_proxy")
if checkProxy.get_active():
useProxy = 1
@@ -598,11 +631,12 @@ class accountPreference_Window:
del self.plugin.accounts[self.account]
self.plugin.send('ACC_CHG', self.account, name)
self.plugin.accounts[name] = {'name': login, 'hostname': hostname,\
- 'password': entryPass.get_text(), 'ressource': \
- entryRessource.get_text(), 'priority' : prio, 'use_proxy': \
- useProxy, 'proxyhost': entryProxyhost.get_text(), 'proxyport': \
- proxyPort, 'keyid': keyID, 'keyname': keyName, 'savegpgpass': \
- save_gpg_pass, 'gpgpass': gpg_pass}
+ 'savepass': savepass, 'password': entryPass.get_text(), \
+ 'ressource': entryRessource.get_text(), 'priority' : prio, \
+ 'autoconnect': autoconnect, 'use_proxy': useProxy, 'proxyhost': \
+ entryProxyhost.get_text(), 'proxyport': proxyPort, 'keyid': keyID, \
+ 'keyname': keyName, 'savegpgpass': save_gpg_pass, \
+ 'gpgpass': gpg_pass}
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts))
#refresh accounts window
if self.plugin.windows.has_key('accounts'):
@@ -623,11 +657,11 @@ class accountPreference_Window:
check.set_active(FALSE)
return
self.plugin.accounts[name] = {'name': login, 'hostname': hostname,\
- 'password': entryPass.get_text(), 'ressource': \
- entryRessource.get_text(), 'priority' : prio, 'use_proxy': useProxy, \
- 'proxyhost': entryProxyhost.get_text(), 'proxyport': proxyPort, \
- 'keyid': keyID, 'keyname': keyName, 'savegpgpass': save_gpg_pass, \
- 'gpgpass': gpg_pass}
+ 'savepass': savepass, 'password': entryPass.get_text(), 'ressource': \
+ entryRessource.get_text(), 'priority' : prio, 'autoconnect': \
+ autoconnect, 'use_proxy': useProxy, 'proxyhost': \
+ entryProxyhost.get_text(), 'proxyport': proxyPort, 'keyid': keyID, \
+ 'keyname': keyName, 'savegpgpass': save_gpg_pass, 'gpgpass': gpg_pass}
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts))
#update variables
self.plugin.windows[name] = {'infos': {}, 'chats': {}, 'gc': {}}
@@ -673,12 +707,16 @@ class accountPreference_Window:
self.xml.get_widget('gpg_pass_checkbutton').set_active(False)
self.xml.get_widget('gpg_pass_entry').set_text('')
- def on_gpg_pass_checkbutton_toggled(self, widget, data=None):
- if self.xml.get_widget('gpg_pass_checkbutton').get_active():
- self.xml.get_widget('gpg_pass_entry').set_sensitive(True)
- else:
- self.xml.get_widget('gpg_pass_entry').set_sensitive(False)
- self.xml.get_widget('gpg_pass_entry').set_text('')
+ def on_chk_toggled(self, widget, widgets):
+ """set or unset sensitivity of widgets when widget is toggled"""
+ for w in widgets:
+ w.set_sensitive(widget.get_active())
+
+ def on_chk_toggled_and_clear(self, widget, widgets):
+ self.on_chk_toggled(widget, widgets)
+ for w in widgets:
+ if not widget.get_active():
+ w.set_text('')
#info must be a dictionnary
def __init__(self, plugin, infos = {}):
@@ -691,6 +729,7 @@ class accountPreference_Window:
self.xml.get_widget('gpg_name_label').set_text('')
self.xml.get_widget('gpg_pass_checkbutton').set_sensitive(False)
self.xml.get_widget('gpg_pass_entry').set_sensitive(False)
+ self.xml.get_widget('entry_password').set_sensitive(False)
if infos:
self.modify = True
self.account = infos['accname']
@@ -703,7 +742,9 @@ class accountPreference_Window:
self.xml.signal_connect('on_close_clicked', self.on_close)
self.xml.signal_connect('on_choose_gpg_clicked', self.on_choose_gpg)
self.xml.signal_connect('on_gpg_pass_checkbutton_toggled', \
- self.on_gpg_pass_checkbutton_toggled)
+ self.on_chk_toggled_and_clear, [self.xml.get_widget('gpg_pass_entry')])
+ self.xml.signal_connect('on_pass_checkbutton_toggled', \
+ self.on_chk_toggled_and_clear, [self.xml.get_widget('entry_password')])
class accounts_Window:
"""Class for accounts window : lists of accounts"""
@@ -711,10 +752,9 @@ class accounts_Window:
"""close window"""
del self.plugin.windows['accounts']
-#Not for the moment ... but maybe one day there will be a button
-# def on_close(self, widget):
-# """When Close button is clicked"""
-# widget.get_toplevel().destroy()
+ def on_close(self, widget):
+ """When Close button is clicked"""
+ widget.get_toplevel().destroy()
def init_accounts(self):
"""initialize listStore with existing accounts"""
@@ -810,6 +850,7 @@ class accounts_Window:
self.xml.signal_connect('on_new_clicked', self.on_new_clicked)
self.xml.signal_connect('on_delete_clicked', self.on_delete_clicked)
self.xml.signal_connect('on_modify_clicked', self.on_modify_clicked)
+ self.xml.signal_connect('on_close_clicked', self.on_close)
self.init_accounts()
diff --git a/plugins/gtkgui/dialogs.py b/plugins/gtkgui/dialogs.py
index d4155a16d..a556cf1bf 100644
--- a/plugins/gtkgui/dialogs.py
+++ b/plugins/gtkgui/dialogs.py
@@ -200,9 +200,10 @@ class passphrase_Window:
if event.keyval == gtk.keysyms.Return:
self.xml.get_widget("Passphrase").response(gtk.RESPONSE_OK)
- def __init__(self):
+ def __init__(self, txt):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Passphrase', APP)
self.entry = self.xml.get_widget("entry")
+ self.xml.get_widget("label").set_text(txt)
self.xml.signal_connect('on_Passphrase_key_press_event', \
self.on_key_pressed)
diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade
index d5fbe763e..d0231209f 100644
--- a/plugins/gtkgui/gtkgui.glade
+++ b/plugins/gtkgui/gtkgui.glade
@@ -693,57 +693,49 @@
0
-
+
+ 5
True
- False
- 20
+ GTK_BUTTONBOX_END
+ 7
True
+ True
True
gtk-new
True
GTK_RELIEF_NORMAL
True
-
+
-
- 0
- False
- False
-
True
- False
+ True
True
gtk-delete
True
GTK_RELIEF_NORMAL
True
-
+
-
- 0
- False
- False
-
True
- False
+ True
True
GTK_RELIEF_NORMAL
True
-
+
-
+
True
0.5
0.5
@@ -755,13 +747,13 @@
0
-
+
True
False
2
-
+
True
gtk-refresh
4
@@ -778,7 +770,7 @@
-
+
True
_Modify
True
@@ -802,11 +794,19 @@
-
- 0
- False
- False
-
+
+
+
+
+ True
+ True
+ True
+ gtk-close
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
@@ -867,7 +867,7 @@
True
- <b>Gajim</b>
+ <b>Gajim</b> (http://www.gajim.org)
Copyright © 2003-2004 Gajim Team
@@ -1064,30 +1064,6 @@ Yann Le Boulanger (asterix@crans.org)
-
-
- True
- Password:
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0
- 0.5
- 0
- 0
-
-
- 0
- 1
- 2
- 3
- fill
-
-
-
-
True
@@ -1242,6 +1218,29 @@ Yann Le Boulanger (asterix@crans.org)
+
+
+
+ True
+ True
+ Save password
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+
+ 0
+ 1
+ 2
+ 3
+ fill
+
+
+
False
@@ -1300,18 +1299,92 @@ Yann Le Boulanger (asterix@crans.org)
-
+
True
- Empty
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 0
- 0
+ False
+ 0
+
+
+
+ True
+ 0
+ 0.5
+ GTK_SHADOW_ETCHED_IN
+
+
+
+ True
+ 0.5
+ 0.5
+ 1
+ 1
+ 0
+ 0
+ 12
+ 0
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ True
+ Connect at startup
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+ 0
+ False
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+ True
+ <b>Startup</b>
+ False
+ True
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+ label_item
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+
False
@@ -3938,180 +4011,6 @@ on the server.
-
-
- 180
- 165
- True
- 0
- 0.5
- GTK_SHADOW_ETCHED_IN
-
-
-
- True
- 3
- 2
- False
- 10
- 3
-
-
-
- 100
- True
- Outgoing Messages
- False
- False
- GTK_JUSTIFY_CENTER
- True
- False
- 0
- 0.5
- 0
- 0
-
-
- 0
- 1
- 1
- 2
- fill
-
-
-
-
-
-
- 100
- True
- Status Messages
- False
- False
- GTK_JUSTIFY_CENTER
- True
- False
- 0
- 0.5
- 0
- 0
-
-
- 0
- 1
- 2
- 3
- fill
-
-
-
-
-
-
- 100
- True
- Incoming Messages
- False
- False
- GTK_JUSTIFY_CENTER
- True
- False
- 0
- 0.5
- 0
- 0
-
-
- 0
- 1
- 0
- 1
- fill
-
-
-
-
-
-
- True
- True
- True
- True
- True
- False
- True
-
-
- 1
- 2
- 0
- 1
- fill
-
-
-
-
-
-
- True
- True
- False
- True
-
-
- 1
- 2
- 1
- 2
- fill
-
-
-
-
-
-
- True
- True
- False
- True
-
-
- 1
- 2
- 2
- 3
- fill
-
-
-
-
-
-
-
-
- True
- <b>Color</b>
- False
- True
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 0
- 0
-
-
- label_item
-
-
-
-
- 0
- 0
-
-
-
145
@@ -4287,6 +4186,180 @@ position
103
+
+
+
+ 180
+ 165
+ True
+ 0
+ 0.5
+ GTK_SHADOW_ETCHED_IN
+
+
+
+ True
+ 3
+ 2
+ False
+ 10
+ 3
+
+
+
+ 100
+ True
+ Outgoing Messages
+ False
+ False
+ GTK_JUSTIFY_CENTER
+ True
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+
+ 0
+ 1
+ 1
+ 2
+ fill
+
+
+
+
+
+
+ 100
+ True
+ Status Messages
+ False
+ False
+ GTK_JUSTIFY_CENTER
+ True
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+
+ 0
+ 1
+ 2
+ 3
+ fill
+
+
+
+
+
+
+ 100
+ True
+ Incoming Messages
+ False
+ False
+ GTK_JUSTIFY_CENTER
+ True
+ False
+ 0
+ 0.5
+ 0
+ 0
+
+
+ 0
+ 1
+ 0
+ 1
+ fill
+
+
+
+
+
+
+ True
+ True
+ True
+ True
+ True
+ False
+ True
+
+
+ 1
+ 2
+ 0
+ 1
+ fill
+
+
+
+
+
+
+ True
+ True
+ False
+ True
+
+
+ 1
+ 2
+ 1
+ 2
+ fill
+
+
+
+
+
+
+ True
+ True
+ False
+ True
+
+
+ 1
+ 2
+ 2
+ 3
+ fill
+
+
+
+
+
+
+
+
+ True
+ <b>Color</b>
+ False
+ True
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+ label_item
+
+
+
+
+ 0
+ 0
+
+
False
@@ -4344,6 +4417,7 @@ messages
False
False
True
+
0
@@ -4457,6 +4531,7 @@ when NOT online
False
False
True
+
0
@@ -4525,6 +4600,7 @@ when NOT online
False
False
True
+
0
@@ -4864,6 +4940,19 @@ when NOT online
+
+
+
+ True
+ True
+ True
+ gtk-apply
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
0
@@ -8468,7 +8557,7 @@ when NOT online
0
-
+
True
Enter your passphrase
False
diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py
index e07b03931..51516f23d 100644
--- a/plugins/gtkgui/gtkgui.py
+++ b/plugins/gtkgui/gtkgui.py
@@ -1346,6 +1346,17 @@ class roster_Window:
def send_status(self, account, status, txt):
if status != 'offline':
+ save_pass = 0
+ if self.plugin.accounts[account].has_key("savepass"):
+ save_pass = self.plugin.accounts[account]["savepass"]
+ if not save_pass and not self.plugin.connected[account]:
+ passphrase = ''
+ w = passphrase_Window('Enter your passphrase for your account %s' % account)
+ passphrase = w.run()
+ if passphrase == -1:
+ return
+ self.plugin.send('PASSPHRASE', account, passphrase)
+
keyid = None
save_gpg_pass = 0
if self.plugin.accounts[account].has_key("savegpgpass"):
@@ -1358,11 +1369,11 @@ class roster_Window:
passphrase = self.plugin.accounts[account]['gpgpass']
else:
passphrase = ''
- w = passphrase_Window()
+ w = passphrase_Window('Enter your passphrase for your the GPG key of your account %s' % account)
passphrase = w.run()
if passphrase == -1:
passphrase = ''
- self.plugin.send('PASSPHRASE', account, passphrase)
+ self.plugin.send('GPGPASSPHRASE', account, passphrase)
self.plugin.send('STATUS', account, (status, txt))
if status == 'online' and self.plugin.sleeper.getState() != \
common.sleepy.STATE_UNKNOWN:
@@ -2396,7 +2407,7 @@ class plugin:
'msg0_name':'Brb',\
'msg0':'Back in some minutes.',\
'msg1_name':'Eating',\
- 'msg1':'I\'m eating, so let a message.',\
+ 'msg1':'I\'m eating, so leave me a message.',\
'msg2_name':'Film',\
'msg2':'I\'m watching a film.',\
'trayicon':1,\
@@ -2453,6 +2464,11 @@ class plugin:
self.roster = roster_Window(self)
gtk.timeout_add(100, self.read_queue)
gtk.timeout_add(1000, self.read_sleepy)
+ #auto connect at startup
+ for a in self.accounts.keys():
+ if self.accounts[a].has_key('autoconnect'):
+ if self.accounts[a]['autoconnect']:
+ self.roster.send_status(a, 'online', 'Online')
self.sleeper = common.sleepy.Sleepy( \
self.config['autoawaytime']*60, \
self.config['autoxatime']*60)