changeset 31478:9a7c5d242521

Add a new proxy type of "Tor". This is really just a SOCKS5 proxy, but can be used to restrict functionality (e.g. DNS lookups) for privacy reasons. Refs #11110
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 19 Apr 2011 04:41:59 +0000
parents f0de3178dd87
children 0eceb1304f53
files libpurple/account.c libpurple/proxy.c libpurple/proxy.h pidgin/gtkaccount.c pidgin/gtkprefs.c
diffstat 5 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/account.c	Tue Apr 19 00:21:32 2011 +0000
+++ b/libpurple/account.c	Tue Apr 19 04:41:59 2011 +0000
@@ -294,6 +294,7 @@
 			 proxy_type == PURPLE_PROXY_HTTP       ? "http"   :
 			 proxy_type == PURPLE_PROXY_SOCKS4     ? "socks4" :
 			 proxy_type == PURPLE_PROXY_SOCKS5     ? "socks5" :
+			 proxy_type == PURPLE_PROXY_TOR        ? "tor" :
 			 proxy_type == PURPLE_PROXY_USE_ENVVAR ? "envvar" : "unknown"), -1);
 
 	if ((value = purple_proxy_info_get_host(proxy_info)) != NULL)
@@ -746,6 +747,8 @@
 			purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_SOCKS4);
 		else if (purple_strequal(data, "socks5"))
 			purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_SOCKS5);
+		else if (purple_strequal(data, "tor"))
+			purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_TOR);
 		else if (purple_strequal(data, "envvar"))
 			purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_ENVVAR);
 		else
--- a/libpurple/proxy.c	Tue Apr 19 00:21:32 2011 +0000
+++ b/libpurple/proxy.c	Tue Apr 19 04:41:59 2011 +0000
@@ -2137,6 +2137,7 @@
 			break;
 
 		case PURPLE_PROXY_SOCKS5:
+		case PURPLE_PROXY_TOR:
 			proxy_connect_socks5(connect_data, addr, addrlen);
 			break;
 
@@ -2299,6 +2300,7 @@
 		case PURPLE_PROXY_HTTP:
 		case PURPLE_PROXY_SOCKS4:
 		case PURPLE_PROXY_SOCKS5:
+		case PURPLE_PROXY_TOR:
 		case PURPLE_PROXY_USE_ENVVAR:
 			connecthost = purple_proxy_info_get_host(connect_data->gpi);
 			connectport = purple_proxy_info_get_port(connect_data->gpi);
@@ -2365,6 +2367,7 @@
 		case PURPLE_PROXY_HTTP:
 		case PURPLE_PROXY_SOCKS4:
 		case PURPLE_PROXY_SOCKS5:
+		case PURPLE_PROXY_TOR:
 		case PURPLE_PROXY_USE_ENVVAR:
 			purple_debug_info("proxy", "Ignoring Proxy type (%d) for UDP.\n",
 			                  purple_proxy_info_get_type(connect_data->gpi));
@@ -2470,6 +2473,8 @@
 			proxytype = PURPLE_PROXY_SOCKS4;
 		else if (purple_strequal(type, "socks5"))
 			proxytype = PURPLE_PROXY_SOCKS5;
+		else if (purple_strequal(type, "tor"))
+			proxytype = PURPLE_PROXY_TOR;
 		else if (purple_strequal(type, "envvar"))
 			proxytype = PURPLE_PROXY_USE_ENVVAR;
 		else
--- a/libpurple/proxy.h	Tue Apr 19 00:21:32 2011 +0000
+++ b/libpurple/proxy.h	Tue Apr 19 04:41:59 2011 +0000
@@ -39,7 +39,8 @@
 	PURPLE_PROXY_HTTP,             /**< HTTP proxy.                       */
 	PURPLE_PROXY_SOCKS4,           /**< SOCKS 4 proxy.                    */
 	PURPLE_PROXY_SOCKS5,           /**< SOCKS 5 proxy.                    */
-	PURPLE_PROXY_USE_ENVVAR        /**< Use environmental settings.       */
+	PURPLE_PROXY_USE_ENVVAR,       /**< Use environmental settings.       */
+	PURPLE_PROXY_TOR               /**< Use a Tor proxy (SOCKS 5 really)  */
 
 } PurpleProxyType;
 
--- a/pidgin/gtkaccount.c	Tue Apr 19 00:21:32 2011 +0000
+++ b/pidgin/gtkaccount.c	Tue Apr 19 04:41:59 2011 +0000
@@ -1021,6 +1021,12 @@
 
 	gtk_list_store_append(model, &iter);
 	gtk_list_store_set(model, &iter,
+			0, _("Tor/Privacy (SOCKS5)"),
+			1, PURPLE_PROXY_TOR,
+			-1);
+
+	gtk_list_store_append(model, &iter);
+	gtk_list_store_set(model, &iter,
 			0, _("Use Environmental Settings"),
 			1, PURPLE_PROXY_USE_ENVVAR,
 			-1);
@@ -2254,7 +2260,7 @@
 					 G_CALLBACK(account_treeview_double_click_cb), dialog);
 
 	gtk_notebook_append_page(GTK_NOTEBOOK(accounts_window->notebook),
-		pidgin_make_scrollable(treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1), 
+		pidgin_make_scrollable(treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1),
 		NULL);
 
 	add_columns(treeview, dialog);
--- a/pidgin/gtkprefs.c	Tue Apr 19 00:21:32 2011 +0000
+++ b/pidgin/gtkprefs.c	Tue Apr 19 04:41:59 2011 +0000
@@ -2041,9 +2041,10 @@
 		pidgin_prefs_dropdown(prefs_proxy_frame, _("Proxy t_ype:"), PURPLE_PREF_STRING,
 					"/purple/proxy/type",
 					_("No proxy"), "none",
-					"SOCKS 4", "socks4",
-					"SOCKS 5", "socks5",
-					"HTTP", "http",
+					_("SOCKS 4"), "socks4",
+					_("SOCKS 5"), "socks5",
+					_("Tor/Privacy (SOCKS5)"), "tor",
+					_("HTTP"), "http",
 					_("Use Environmental Settings"), "envvar",
 					NULL);
 		gtk_box_pack_start(GTK_BOX(prefs_proxy_frame), prefs_proxy_subframe, 0, 0, 0);