we now support user and password for proxy

This commit is contained in:
Yann Leboulanger 2005-05-10 15:38:16 +00:00
parent 8175a92f7d
commit 6fa84c0dfe
3 changed files with 24 additions and 5 deletions

View File

@ -108,6 +108,8 @@ class Config:
'use_proxy': [ opt_bool, False ],
'proxyhost': [ opt_str, '' ],
'proxyport': [ opt_int, 3128 ],
'proxyuser': [ opt_str, '' ],
'proxypass': [ opt_str, '' ],
'keyid': [ opt_str, '' ],
'keyname': [ opt_str, '' ],
'usetls': [ opt_bool, True ],

View File

@ -512,10 +512,14 @@ class Connection:
return self.connection
self.connected = 1
if gajim.config.get_per('accounts', self.name, 'use_proxy'):
proxy = {'host': gajim.config.get_per('accounts', self.name, \
proxy = {'host': gajim.config.get_per('accounts', self.name,
'proxyhost')}
proxy['port'] = gajim.config.get_per('accounts', self.name, \
proxy['port'] = gajim.config.get_per('accounts', self.name,
'proxyport')
proxy['user'] = gajim.config.get_per('accounts', self.name,
'proxyuser')
proxy['password'] = gajim.config.get_per('accounts', self.name,
'proxypass')
else:
proxy = None
if gajim.config.get('verbose'):
@ -764,7 +768,8 @@ class Connection:
if self.connection:
return
if config['use_proxy']:
proxy = {'host': config['proxyhost'], 'port': config['proxyport']}
proxy = {'host': config['proxyhost'], 'port': config['proxyport'],
'user': config['proxyuser'], 'password': config['proxypass']}
else:
proxy = None
c = common.xmpp.Client(server = config['hostname'], debug = [])

View File

@ -979,8 +979,18 @@ class Account_modification_window:
'proxyhost'))
entry = self.xml.get_widget('proxyport_entry')
entry.set_sensitive(use_proxy)
entry.set_text(str(gajim.config.get_per('accounts',
self.account, 'proxyport')))
entry.set_text(gajim.config.get_per('accounts', self.account,
'proxyport'))
entry = self.xml.get_widget('proxyuser_entry')
entry.set_sensitive(use_proxy)
entry.set_text(gajim.config.get_per('accounts', self.account,
'proxyuser'))
entry = self.xml.get_widget('proxypass_entry')
entry.set_sensitive(use_proxy)
entry.set_text(gajim.config.get_per('accounts', self.account,
'proxypass')))
usetls = gajim.config.get_per('accounts', self.account, 'usetls')
self.xml.get_widget('use_tls_checkbutton').set_active(usetls)
@ -1051,6 +1061,8 @@ class Account_modification_window:
get_active()
config['proxyhost'] = self.xml.get_widget('proxyhost_entry').get_text()
config['proxyport'] = self.xml.get_widget('proxyport_entry').get_text()
config['proxyuser'] = self.xml.get_widget('proxyuser_entry').get_text()
config['proxypass'] = self.xml.get_widget('proxypass_entry').get_text()
if config['use_proxy']:
if config['proxyport'] != '':
try: