add an ui option to disable the use of FT proxies. Fixes #1751

This commit is contained in:
Yann Leboulanger 2006-03-27 08:28:05 +00:00
parent 186d69931e
commit 88730b1ea1
4 changed files with 40 additions and 3 deletions

View File

@ -230,6 +230,7 @@ class Config:
# proxy65 for FT
'file_transfer_proxies': [opt_str,
'proxy.jabber.org, proxy.netlab.cz, transfer.jabber.freenet.de'],
'use_ft_proxies': [opt_bool, True, _('If checked, Gajim will use your IP and proxies defined in file_transfer_proxies option for file transfer.'), True],
'msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide
'msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
'msgwin-width': [opt_int, 480],

View File

@ -189,7 +189,8 @@ class ConnectionBytestream:
streamhost.setAttr('port', unicode(port))
streamhost.setAttr('host', ft_override_host_to_send)
streamhost.setAttr('jid', sender)
if fast and proxyhosts != []:
if fast and proxyhosts != [] and gajim.config.get_per('accounts',
self.name, 'use_ft_proxies'):
file_props['proxy_receiver'] = unicode(receiver)
file_props['proxy_sender'] = unicode(sender)
file_props['proxyhosts'] = proxyhosts
@ -1533,14 +1534,18 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
if not self.connection:
return
self.connection.getRoster(self._on_roster_set)
if gajim.config.get_per('accounts', self.name, 'use_ft_proxies'):
self.discover_ft_proxies()
def discover_ft_proxies(self):
cfg_proxies = gajim.config.get_per('accounts', self.name,
'file_transfer_proxies')
'file_transfer_proxies')
if cfg_proxies:
proxies = map(lambda e:e.strip(), cfg_proxies.split(','))
for proxy in proxies:
gajim.proxy65_manager.resolve(proxy, self.connection)
self.discoverItems(gajim.config.get_per('accounts', self.name,
'hostname'), id_prefix='p')
'hostname'), id_prefix='p')
def _on_roster_set(self, roster):
raw_roster = roster.getRaw()

View File

@ -1086,6 +1086,8 @@ class AccountModificationWindow:
'sync_with_global_status'))
self.xml.get_widget('autoconnect_checkbutton').set_active(
gajim.config.get_per('accounts', self.account, 'autoconnect'))
self.xml.get_widget('use_ft_proxies_checkbutton').set_active(
gajim.config.get_per('accounts', self.account, 'use_ft_proxies'))
list_no_log_for = gajim.config.get_per('accounts', self.account,
'no_log_for').split()
if self.account in list_no_log_for:
@ -1174,6 +1176,8 @@ class AccountModificationWindow:
config['sync_with_global_status'] = self.xml.get_widget(
'sync_with_global_status_checkbutton').get_active()
config['use_ft_proxies'] = self.xml.get_widget(
'use_ft_proxies_checkbutton').get_active()
active = self.proxy_combobox.get_active()
proxy = self.proxy_combobox.get_model()[active][0].decode('utf-8')
@ -1272,6 +1276,10 @@ class AccountModificationWindow:
'custom_host') or self.option_changed(config, 'custom_port')):
relogin_needed = True
if self.option_changed(config, 'use_ft_proxies') and \
config['use_ft_proxies']:
gajim.connections[self.account].discover_ft_proxies()
if relogin_needed:
dialog = dialogs.YesNoDialog(_('Relogin now?'),
_('If you want all the changes to apply instantly, '

View File

@ -1117,6 +1117,25 @@
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="use_ft_proxies_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use file transfer proxies</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
@ -1684,6 +1703,10 @@
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkFrame" id="frame37">
<property name="visible">True</property>