diff --git a/src/common/config.py b/src/common/config.py
index 0c64e12f9..ebe900468 100644
--- a/src/common/config.py
+++ b/src/common/config.py
@@ -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],
diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py
index a0fee6fa6..c11526655 100644
--- a/src/common/connection_handlers.py
+++ b/src/common/connection_handlers.py
@@ -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()
diff --git a/src/config.py b/src/config.py
index 7b767416c..bb3b59c93 100644
--- a/src/config.py
+++ b/src/config.py
@@ -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, '
diff --git a/src/gtkgui.glade b/src/gtkgui.glade
index 5436a2c38..af77ec210 100644
--- a/src/gtkgui.glade
+++ b/src/gtkgui.glade
@@ -1117,6 +1117,25 @@
False
+
+
+
+ True
+ True
+ Use file transfer proxies
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+ 0
+ False
+ False
+
+
False
@@ -1684,6 +1703,10 @@
+
+
+
+
True