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 ], 'use_proxy': [ opt_bool, False ],
'proxyhost': [ opt_str, '' ], 'proxyhost': [ opt_str, '' ],
'proxyport': [ opt_int, 3128 ], 'proxyport': [ opt_int, 3128 ],
'proxyuser': [ opt_str, '' ],
'proxypass': [ opt_str, '' ],
'keyid': [ opt_str, '' ], 'keyid': [ opt_str, '' ],
'keyname': [ opt_str, '' ], 'keyname': [ opt_str, '' ],
'usetls': [ opt_bool, True ], 'usetls': [ opt_bool, True ],

View File

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

View File

@ -979,8 +979,18 @@ class Account_modification_window:
'proxyhost')) 'proxyhost'))
entry = self.xml.get_widget('proxyport_entry') entry = self.xml.get_widget('proxyport_entry')
entry.set_sensitive(use_proxy) entry.set_sensitive(use_proxy)
entry.set_text(str(gajim.config.get_per('accounts', entry.set_text(gajim.config.get_per('accounts', self.account,
self.account, 'proxyport'))) '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') usetls = gajim.config.get_per('accounts', self.account, 'usetls')
self.xml.get_widget('use_tls_checkbutton').set_active(usetls) self.xml.get_widget('use_tls_checkbutton').set_active(usetls)
@ -1051,6 +1061,8 @@ class Account_modification_window:
get_active() get_active()
config['proxyhost'] = self.xml.get_widget('proxyhost_entry').get_text() config['proxyhost'] = self.xml.get_widget('proxyhost_entry').get_text()
config['proxyport'] = self.xml.get_widget('proxyport_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['use_proxy']:
if config['proxyport'] != '': if config['proxyport'] != '':
try: try: