add a Tor proxy in default configuration when Gajim starts. Fixes #7026

This commit is contained in:
Yann Leboulanger 2011-11-14 18:44:17 +01:00
parent 55d48e0d7c
commit b28b3d4ed3
2 changed files with 16 additions and 0 deletions

View File

@ -519,6 +519,10 @@ class Config:
}
proxies_default = {
_('Tor'): ['socks5', 'localhost', 9050],
}
def foreach(self, cb, data = None):
for opt in self.__options:
cb(data, opt, None, self.__options[opt])

View File

@ -2651,6 +2651,18 @@ class Interface:
for o in d:
gajim.config.set_per('themes', theme_name, o,
theme[d.index(o)])
# Add Tor proxy if there is not in the config
if len(gajim.config.get_per('proxies')) == 0:
default = gajim.config.proxies_default
for proxy in default:
gajim.config.add_per('proxies', proxy)
gajim.config.set_per('proxies', proxy, 'type',
default[proxy][0])
gajim.config.set_per('proxies', proxy, 'host',
default[proxy][1])
gajim.config.set_per('proxies', proxy, 'port',
default[proxy][2])
gajim.idlequeue = idlequeue.get_idlequeue()
# resolve and keep current record of resolved hosts