Prompt password if no password is provided in config file

This commit is contained in:
Florent Le Coz 2011-01-13 23:20:17 +01:00
parent c94be4761a
commit 7509fb0002
2 changed files with 3 additions and 1 deletions

View file

@ -28,6 +28,7 @@ default_nick =
jid = jid =
# A password is needed only if you specified a jid. It will be ignored otherwise # A password is needed only if you specified a jid. It will be ignored otherwise
# If you leave this empty, the password will be asked at each startup
password = password =
# the rooms you will join automatically on startup, with associated nickname or not # the rooms you will join automatically on startup, with associated nickname or not

View file

@ -25,6 +25,7 @@ from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset,
gettext as _) gettext as _)
import sys import sys
import getpass
import sleekxmpp import sleekxmpp
from config import config from config import config
@ -43,7 +44,7 @@ class Connection(sleekxmpp.ClientXMPP):
# many features will be handled diferently # many features will be handled diferently
# depending on this setting # depending on this setting
jid = '%s/%s' % (config.get('jid', ''), resource) jid = '%s/%s' % (config.get('jid', ''), resource)
password = config.get('password', '') password = config.get('password', '') or getpass.getpass()
else: # anonymous auth else: # anonymous auth
self.anon = True self.anon = True
jid = '%s/%s' % (config.get('server', 'anon.louiz.org'), resource) jid = '%s/%s' % (config.get('server', 'anon.louiz.org'), resource)