changeset 31977:db082e0421f6

xmpp: Don't advertise our IPs as available streamhosts when using a TOR proxy. If we weren't string-frozen, I'd use a new separate account option for this. Refs #13928
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 03 May 2011 02:26:35 +0000
parents adb809e5e7d4
children b2f6fec7b98e b9f58c31afc7
files libpurple/protocols/jabber/si.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/si.c	Mon May 02 19:08:52 2011 +0000
+++ b/libpurple/protocols/jabber/si.c	Tue May 03 02:26:35 2011 +0000
@@ -965,15 +965,23 @@
 jabber_si_xfer_bytestreams_send_init(PurpleXfer *xfer)
 {
 	JabberSIXfer *jsx;
+	PurpleProxyType proxy_type;
 
 	purple_xfer_ref(xfer);
 
 	jsx = xfer->data;
 
-	/* TODO: Should there be an option to not use the local host as a ft proxy?
-	 *       (to prevent revealing IP address, etc.) */
-	jsx->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM,
+	/* TODO: This should probably be done with an account option instead of
+	 *       piggy-backing on the TOR proxy type. */
+	proxy_type = purple_proxy_info_get_type(
+		purple_proxy_get_setup(purple_connection_get_account(jsx->js->gc)));
+	if (proxy_type == PURPLE_PROXY_TOR) {
+		purple_debug_info("jabber", "Skipping attempting local streamhost.\n");
+		jsx->listen_data = NULL;
+	} else
+		jsx->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM,
 				jabber_si_xfer_bytestreams_listen_cb, xfer);
+
 	if (jsx->listen_data == NULL) {
 		/* We couldn't open a local port.  Perhaps we can use a proxy. */
 		jabber_si_xfer_bytestreams_listen_cb(-1, xfer);