changeset 1087:56c7ceb986a8

[gaim-migrate @ 1097] thank god, someone finally redid the proxy stuff. i think most of it works even. isn't that neat? thanks adam. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 12 Nov 2000 23:54:07 +0000
parents ce201056e7a6
children 18a14e6dd0af
files src/browser.c src/dialogs.c src/gaim.h src/gaimrc.c src/html.c src/network.c src/prefs.c src/proxy.c src/proxy.h src/rvous.c src/toc.c src/util.c
diffstat 12 files changed, 405 insertions(+), 537 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser.c	Sun Nov 12 14:14:12 2000 +0000
+++ b/src/browser.c	Sun Nov 12 23:54:07 2000 +0000
@@ -685,8 +685,6 @@
 		} else {
 			gtk_timeout_add(1000, (GtkFunction)clean_pid, NULL);
 		}
-        } else if (web_browser == BROWSER_INTERNAL) {
-                g_show_info(url);
         }
 }
 
--- a/src/dialogs.c	Sun Nov 12 14:14:12 2000 +0000
+++ b/src/dialogs.c	Sun Nov 12 23:54:07 2000 +0000
@@ -1701,8 +1701,8 @@
 	gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw)), 0);
 }
 
-void g_show_info(char *url) {
-	char *url_text = grab_url(url);
+void g_show_info(struct aim_user *user, char *url) {
+	char *url_text = grab_url(user, url);
 	if (connections)
 		g_show_info_text(away_subs(url_text,
 					((struct gaim_connection *)connections->data)->username));
--- a/src/gaim.h	Sun Nov 12 14:14:12 2000 +0000
+++ b/src/gaim.h	Sun Nov 12 23:54:07 2000 +0000
@@ -57,7 +57,7 @@
 #define BROWSER_NETSCAPE              0
 #define BROWSER_KFM                   1
 #define BROWSER_MANUAL                2
-#define BROWSER_INTERNAL              3
+/*#define BROWSER_INTERNAL              3*/
 #define BROWSER_GNOME                 4
 
 #define PERMIT_ALL	1
@@ -574,8 +574,6 @@
 extern char debug_buff[BUF_LONG];
 extern char aim_host[512];
 extern int aim_port;
-extern char login_host[512];
-extern int login_port;
 extern struct save_pos blist_pos;
 extern char latest_ver[25];
 
@@ -599,7 +597,7 @@
 /* Functions in html.c */
 extern char *fix_url(char *);
 extern struct g_url parse_url(char *);
-extern char *grab_url(char *);
+extern char *grab_url(struct aim_user *, char *);
 extern gchar *strip_html(gchar *);
 
 /* Functions in idle.c */
@@ -830,7 +828,7 @@
 extern void show_log_dialog(struct conversation *);
 extern void show_find_email();
 extern void show_find_info();
-extern void g_show_info (char *);
+extern void g_show_info (struct aim_user *, char *);
 extern void g_show_info_text (char *);
 extern void show_set_info();
 extern void show_set_dir();
--- a/src/gaimrc.c	Sun Nov 12 14:14:12 2000 +0000
+++ b/src/gaimrc.c	Sun Nov 12 23:54:07 2000 +0000
@@ -33,7 +33,6 @@
 #include <stdlib.h>
 #include <gtk/gtk.h>
 #include "gaim.h"
-#include "proxy.h"
 
 /* for people like myself, who are too lazy to add an away msg :) */
 #define BORING_DEFAULT_AWAY_MSG "sorry, i ran out for a while. bbl"
@@ -49,8 +48,6 @@
 char web_command[2048];
 char aim_host[512];
 int aim_port;
-char login_host[512];
-int login_port;
 char latest_ver[25];
 char *sound_file[NUM_SOUNDS];
 
@@ -630,20 +627,6 @@
                         web_browser = atoi(p->value[0]);
                 } else if (!strcmp(p->option, "web_command")) {
                         strcpy(web_command, p->value[0]);
-                } else if (!strcmp(p->option, "proxy_type")) {
-                        proxy_type = atoi(p->value[0]);
-                } else if (!strcmp(p->option, "proxy_host")) {
-                        strcpy(proxy_host, p->value[0]);
-                } else if (!strcmp(p->option, "proxy_port")) {
-                        proxy_port = atoi(p->value[0]);
-                } else if (!strcmp(p->option, "aim_host")) {
-                        strcpy(aim_host, p->value[0]);
-                } else if (!strcmp(p->option, "aim_port")) {
-                        aim_port = atoi(p->value[0]);
-                } else if (!strcmp(p->option, "login_host")) {
-                        strcpy(login_host, p->value[0]);
-                } else if (!strcmp(p->option, "login_port")) {
-                        login_port = atoi(p->value[0]);
                 } else if (!strcmp(p->option, "blist_pos")) {
                         blist_pos.x = atoi(p->value[0]);
                         blist_pos.y = atoi(p->value[1]);
@@ -672,13 +655,6 @@
         fprintf(f, "\treport_idle { %d }\n", report_idle);
         fprintf(f, "\tweb_browser { %d }\n", web_browser);
         fprintf(f, "\tweb_command { %s }\n", web_command);
-        fprintf(f, "\tproxy_type { %d }\n", proxy_type);
-        fprintf(f, "\tproxy_host { %s }\n", proxy_host);
-        fprintf(f, "\tproxy_port { %d }\n", proxy_port);
-        fprintf(f, "\taim_host { %s }\n", aim_host);
-        fprintf(f, "\taim_port { %d }\n", aim_port);
-        fprintf(f, "\tlogin_host { %s }\n", login_host);
-        fprintf(f, "\tlogin_port { %d }\n", login_port);
         fprintf(f, "\tblist_pos { %d } { %d } { %d } { %d } { %d } { %d }\n",
                 blist_pos.x, blist_pos.y, blist_pos.width, blist_pos.height,
                 blist_pos.xoff, blist_pos.yoff);
@@ -783,14 +759,7 @@
         	sound_options = OPT_SOUND_LOGIN | OPT_SOUND_LOGOUT | OPT_SOUND_RECV | OPT_SOUND_SEND | OPT_SOUND_SILENT_SIGNON;
         	report_idle = IDLE_SCREENSAVER;
         	web_browser = BROWSER_NETSCAPE;
-        	proxy_type = PROXY_NONE;
         
-		aim_port = TOC_PORT;
-		login_port = AUTH_PORT;
-		g_snprintf(aim_host, sizeof(aim_host), "%s", TOC_HOST);
-    		g_snprintf(login_host, sizeof(login_host), "%s", AUTH_HOST);
-        	proxy_host[0] = 0;
-        	proxy_port = 0;
         	g_snprintf(web_command, sizeof(web_command), "xterm -e lynx %%s");
         	blist_pos.width = 0;
         	blist_pos.height = 0;
--- a/src/html.c	Sun Nov 12 14:14:12 2000 +0000
+++ b/src/html.c	Sun Nov 12 23:54:07 2000 +0000
@@ -100,7 +100,7 @@
 	return test;
 }
 
-char *grab_url(char *url)
+char *grab_url(struct aim_user *user, char *url)
 {
 	struct g_url website;
 	char *webdata = NULL;
@@ -116,10 +116,14 @@
 
         website = parse_url(url);
 
-	host = (struct in_addr *)get_address(website.address);
-	if (!host) { return g_strdup(_("g001: Error resolving host\n")); }
-	if ((sock = connect_address(host->s_addr, website.port)) < 0)
-		return g_strdup(_("g003: Error opening connection.\n"));
+	if (user) {
+		if ((sock = proxy_connect(website.address, website.port, user->proto_opt[2],
+					user->proto_opt[3], atoi(user->proto_opt[4]))) < 0)
+			return g_strdup(_("g003: Error opening connection.\n"));
+	} else {
+		if ((sock = proxy_connect(website.address, website.port, NULL, NULL, -1)) < 0)
+			return g_strdup(_("g003: Error opening connection.\n"));
+	}
 
 	g_snprintf(buf, sizeof(buf), "GET /%s HTTP/1.0\r\n\r\n", website.page);
 	g_snprintf(debug_buff, sizeof(debug_buff), "Request: %s\n", buf);
--- a/src/network.c	Sun Nov 12 14:14:12 2000 +0000
+++ b/src/network.c	Sun Nov 12 23:54:07 2000 +0000
@@ -18,56 +18,3 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-
-#ifdef HAVE_CONFIG_H
-#include "../config.h"
-#endif
-#include <netdb.h>
-#include <gtk/gtk.h>
-#include <unistd.h>
-#include <errno.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <sys/socket.h>
-#include "gaim.h"
-#include "proxy.h"
-#include "gnome_applet_mgr.h"
-
-unsigned int *get_address(char *hostname)
-{
-	struct hostent *hp;
-	unsigned int *sin=NULL;
-	if ((hp = proxy_gethostbyname(hostname))) {
-		sin = (unsigned int *)g_new0(struct sockaddr_in, 1);
-		memcpy(sin, hp->h_addr, hp->h_length);
-	}
-	return sin;
-}
-
-int connect_address(unsigned int addy, unsigned short port)
-{
-        int fd;
-	struct sockaddr_in sin;
-
-	sin.sin_addr.s_addr = addy;
-	sin.sin_family = AF_INET;
-	sin.sin_port = htons(port);
-	
-	fd = socket(AF_INET, SOCK_STREAM, 0);
-	
-	if (fd > -1) {
-		if (quad_addr)
-			g_free (quad_addr);
-		
-		quad_addr=g_strdup(inet_ntoa(sin.sin_addr));
-		if (proxy_connect(fd, (struct sockaddr *)&sin, sizeof(sin)) > -1) {
-			return fd;
-		}
-	}
-	return -1;
-}
-
--- a/src/prefs.c	Sun Nov 12 14:14:12 2000 +0000
+++ b/src/prefs.c	Sun Nov 12 23:54:07 2000 +0000
@@ -34,7 +34,6 @@
 #include <stdarg.h>
 #include <gtk/gtk.h>
 #include "gaim.h"
-#include "proxy.h"
 #include "gnome_applet_mgr.h"
 #include "pixmaps/cancel.xpm"
 #include "pixmaps/fontface2.xpm"
@@ -51,7 +50,6 @@
 
 static GtkWidget *gaim_button(const char *, int *, int, GtkWidget *);
 static void prefs_build_general(GtkWidget *);
-static void prefs_build_proxy(GtkWidget *);
 #ifdef USE_APPLET
 static void prefs_build_applet(GtkWidget *);
 #endif
@@ -156,183 +154,6 @@
 	gtk_widget_show(prefdialog);
 }
 
-static GtkWidget *aim_host_entry;
-static GtkWidget *aim_port_entry;
-static GtkWidget *login_host_entry;
-static GtkWidget *login_port_entry;
-static GtkWidget *proxy_host_entry;
-static GtkWidget *proxy_port_entry;
-
-static int connection_key_pressed(GtkWidget *w, GdkEvent *event, void *dummy)
-{
-	g_snprintf(aim_host, sizeof(aim_host), "%s", gtk_entry_get_text(GTK_ENTRY(aim_host_entry)));
-	sscanf(gtk_entry_get_text(GTK_ENTRY(aim_port_entry)), "%d", &aim_port);
-	g_snprintf(login_host, sizeof(login_host), "%s", gtk_entry_get_text(GTK_ENTRY(login_host_entry)));
-	sscanf(gtk_entry_get_text(GTK_ENTRY(login_port_entry)), "%d", &login_port);
-	if (proxy_type != PROXY_NONE) {
-		g_snprintf(proxy_host, sizeof(proxy_host), "%s", gtk_entry_get_text(GTK_ENTRY(proxy_host_entry)));
-		sscanf(gtk_entry_get_text(GTK_ENTRY(proxy_port_entry)), "%d", &proxy_port);
-	}
-	save_prefs();
-	return TRUE;
-}
-
-static void set_connect(GtkWidget *w, int *data)
-{
-        proxy_type = (int)data;
-        if (proxy_type != PROXY_NONE) {
-                if (proxy_host_entry)
-                        gtk_widget_set_sensitive(proxy_host_entry, TRUE);
-                if (proxy_port_entry)
-                        gtk_widget_set_sensitive(proxy_port_entry, TRUE);
-        } else {
-                if (proxy_host_entry)
-                        gtk_widget_set_sensitive(proxy_host_entry, FALSE);
-                if (proxy_port_entry)
-                        gtk_widget_set_sensitive(proxy_port_entry, FALSE);
-        }
-
-        save_prefs();
-}
-
-static GtkWidget *connect_radio(char *label, int which, GtkWidget *box, GtkWidget *set)
-{
-	GtkWidget *opt;
-
-	if (!set)
-		opt = gtk_radio_button_new_with_label(NULL, label);
-	else
-		opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(set)), label);
-	gtk_box_pack_start(GTK_BOX(box), opt, FALSE, FALSE, 0);
-	gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(set_connect), (void *)which);
-	gtk_widget_show(opt);
-	if (proxy_type == which)
-		gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
-
-	return opt;
-}
-
-static void connect_destroy(GtkWidget *n, gpointer d)
-{
-	proxy_host_entry = NULL;
-	proxy_port_entry = NULL;
-}
-
-static void proxy_page()
-{
-	GtkWidget *parent;
-	GtkWidget *box;
-	GtkWidget *label;
-	GtkWidget *hbox;
-	GtkWidget *opt;
-	char buffer[1024];
-
-	parent = prefdialog->parent;
-	gtk_widget_destroy(prefdialog);
-
-	prefdialog = gtk_frame_new(_("Proxy Options"));
-	gtk_container_add(GTK_CONTAINER(parent), prefdialog);
-	gtk_signal_connect(GTK_OBJECT(prefdialog), "destroy", GTK_SIGNAL_FUNC(connect_destroy), 0);
-
-	box = gtk_vbox_new(FALSE, 5);
-	gtk_container_add(GTK_CONTAINER(prefdialog), box);
-	gtk_widget_show(box);
-
-	hbox = gtk_hbox_new(FALSE, 0);
-	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
-	gtk_widget_show(hbox);
-
-	label = gtk_label_new(_("TOC Host:"));
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
-	gtk_widget_show(label);
-
-	aim_host_entry = gtk_entry_new();
-	gtk_box_pack_start(GTK_BOX(hbox), aim_host_entry, FALSE, FALSE, 0);
-	gtk_entry_set_text(GTK_ENTRY(aim_host_entry), aim_host);
-	gtk_signal_connect(GTK_OBJECT(aim_host_entry), "focus_out_event", GTK_SIGNAL_FUNC(connection_key_pressed), NULL);
-	gtk_widget_show(aim_host_entry);
-
-	label = gtk_label_new(_("Port:"));
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
-	gtk_widget_show(label);
-
-	aim_port_entry = gtk_entry_new();
-	gtk_box_pack_start(GTK_BOX(hbox), aim_port_entry, FALSE, FALSE, 0);
-	g_snprintf(buffer, sizeof(buffer), "%d", aim_port);
-	gtk_entry_set_text(GTK_ENTRY(aim_port_entry), buffer);
-	gtk_signal_connect(GTK_OBJECT(aim_port_entry), "focus_out_event", GTK_SIGNAL_FUNC(connection_key_pressed), NULL);
-	gtk_widget_show(aim_port_entry);
-
-	hbox = gtk_hbox_new(FALSE, 0);
-	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
-	gtk_widget_show(hbox);
-
-	label = gtk_label_new(_("Login Host:"));
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
-	gtk_widget_show(label);
-
-	login_host_entry = gtk_entry_new();
-	gtk_box_pack_start(GTK_BOX(hbox), login_host_entry, FALSE, FALSE, 0);
-	gtk_entry_set_text(GTK_ENTRY(login_host_entry), login_host);
-	gtk_signal_connect(GTK_OBJECT(login_host_entry), "focus_out_event", GTK_SIGNAL_FUNC(connection_key_pressed), NULL);
-	gtk_widget_show(login_host_entry);
-
-	label = gtk_label_new(_("Port:"));
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
-	gtk_widget_show(label);
-
-	login_port_entry = gtk_entry_new();
-	gtk_box_pack_start(GTK_BOX(hbox), login_port_entry, FALSE, FALSE, 0);
-	g_snprintf(buffer, sizeof(buffer), "%d", login_port);
-	gtk_entry_set_text(GTK_ENTRY(login_port_entry), buffer);
-	gtk_signal_connect(GTK_OBJECT(login_port_entry), "focus_out_event", GTK_SIGNAL_FUNC(connection_key_pressed), NULL);
-	gtk_widget_show(login_port_entry);
-
-	opt = connect_radio(_("No Proxy"), PROXY_NONE, box, NULL);
-	opt = connect_radio(_("HTTP Proxy"), PROXY_HTTP, box, opt);
-	opt = connect_radio(_("Socks 4 Proxy"), PROXY_SOCKS4, box, opt);
-	opt = connect_radio(_("Socks 5 Proxy"), PROXY_SOCKS5, box, opt);
-
-	hbox = gtk_hbox_new(FALSE, 0);
-	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
-	gtk_widget_show(hbox);
-
-	label = gtk_label_new(_("Proxy Host:"));
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
-	gtk_widget_show(label);
-
-	proxy_host_entry = gtk_entry_new();
-	gtk_box_pack_start(GTK_BOX(hbox), proxy_host_entry, FALSE, FALSE, 0);
-	gtk_entry_set_text(GTK_ENTRY(proxy_host_entry), proxy_host);
-	gtk_signal_connect(GTK_OBJECT(proxy_host_entry), "focus_out_event", GTK_SIGNAL_FUNC(connection_key_pressed), NULL);
-	gtk_widget_show(proxy_host_entry);
-
-	hbox = gtk_hbox_new(FALSE, 0);
-	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
-	gtk_widget_show(hbox);
-
-	label = gtk_label_new(_("Port:"));
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
-	gtk_widget_show(label);
-
-	proxy_port_entry = gtk_entry_new();
-	gtk_box_pack_start(GTK_BOX(hbox), proxy_port_entry, FALSE, FALSE, 0);
-	g_snprintf(buffer, sizeof(buffer), "%d", proxy_port);
-	gtk_entry_set_text(GTK_ENTRY(proxy_port_entry), buffer);
-	gtk_signal_connect(GTK_OBJECT(proxy_port_entry), "focus_out_event", GTK_SIGNAL_FUNC(connection_key_pressed), NULL);
-	gtk_widget_show(proxy_port_entry);
-
-	if (proxy_type != PROXY_NONE) {
-		gtk_widget_set_sensitive(proxy_host_entry, TRUE);
-		gtk_widget_set_sensitive(proxy_port_entry, TRUE);
-	} else {
-		gtk_widget_set_sensitive(proxy_host_entry, FALSE);
-		gtk_widget_set_sensitive(proxy_port_entry, FALSE);
-	}
-
-	gtk_widget_show(prefdialog);
-}
-
 #ifdef USE_APPLET
 static void applet_page()
 {
@@ -652,7 +473,7 @@
 
 static void refresh_list(GtkWidget *w, gpointer *m)
 {
-        char *text = grab_url("http://www.aol.com/community/chat/allchats.html");
+        char *text = grab_url(NULL, "http://www.aol.com/community/chat/allchats.html");
         char *c;
         int len = strlen(text);
         GtkWidget *item;
@@ -1449,7 +1270,6 @@
 #ifdef USE_GNOME
 	opt = browser_radio(_("GNOME URL Handler"), BROWSER_GNOME, box, opt);
 #endif /* USE_GNOME */
-	opt = browser_radio(_("Internal HTML Widget (Quite likely a bad idea!)"), BROWSER_INTERNAL, box, opt);
 	opt = browser_radio(_("Manual"), BROWSER_MANUAL, box, opt);
 
 	browser_entry = gtk_entry_new();
@@ -1543,7 +1363,6 @@
 	gtk_widget_show(prefdialog);
 
 	prefs_build_general(preftree);
-	prefs_build_proxy(preftree);
 #ifdef USE_APPLET
 	prefs_build_applet(preftree);
 #endif
@@ -1757,17 +1576,6 @@
 	gtk_ctree_select(GTK_CTREE(preftree), parent);
 }
 
-void prefs_build_proxy(GtkWidget *preftree)
-{
-	GtkCTreeNode *parent;
-	char *text[1];
-
-	text[0] = _("Proxy");
-	parent = gtk_ctree_insert_node(GTK_CTREE(preftree), NULL, NULL,
-					text, 5, NULL, NULL, NULL, NULL, 0, 1);
-	gtk_ctree_node_set_row_data(GTK_CTREE(preftree), parent, proxy_page);
-}
-
 #ifdef USE_APPLET
 void prefs_build_applet(GtkWidget *preftree)
 {
--- a/src/proxy.c	Sun Nov 12 14:14:12 2000 +0000
+++ b/src/proxy.c	Sun Nov 12 23:54:07 2000 +0000
@@ -38,16 +38,8 @@
 #include "gaim.h"
 #include "proxy.h"
 
-
-/* static int proxy_inited=0; */
-int proxy_type = 0;
-char proxy_host[256];
-int proxy_port = 3128;
-char *proxy_realhost = NULL;
-
 /* this code is borrowed from cvs 1.10 */
-static int
-proxy_recv_line (int sock, char **resultp)
+static int proxy_recv_line (int sock, char **resultp)
 {
     int c;
     char *result;
@@ -93,183 +85,222 @@
     return input_index;
 }
 
-
-struct hostent *proxy_gethostbyname(char *host)
+static int proxy_connect_none(char *host, unsigned short port)
 {
-    
-        if (proxy_type == PROXY_NONE)
-                return (gethostbyname(host));
+	struct sockaddr_in sin;
+	struct hostent *hp;
+	int fd = -1;
+
+	debug_printf("connecting to %s:%d with no proxy\n", host, port);
+
+	if (!(hp = gethostbyname(host))) 
+		return -1;
+
+	memset(&sin, 0, sizeof(struct sockaddr_in));
+	memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length);
+	sin.sin_family = hp->h_addrtype;
+	sin.sin_port = htons(port);
+
+	if ((fd = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0)
+		return -1;
+
+	if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
+		close(fd);
+		return -1;
+	}
+
+	return fd;
+}
+
+#define HTTP_GOODSTRING "HTTP/1.0 200 Connection established"
+#define HTTP_GOODSTRING2 "HTTP/1.1 200 Connection established"
+
+static int proxy_connect_http(char *host, unsigned short port,
+                              char *proxyhost, unsigned short proxyport)
+{
+	struct hostent *hp;
+	struct sockaddr_in sin;
+	int fd = -1;
+	char cmd[384];
+	char *inputline;
 
-        if (proxy_realhost != NULL)
-                g_free(proxy_realhost);
+	debug_printf("connecting to %s:%d via %s:%d using HTTP\n", host, port, proxyhost, proxyport);
+
+	if (!(hp = gethostbyname(proxyhost))) 
+		return -1;
+
+	memset(&sin, 0, sizeof(struct sockaddr_in));
+	memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length);
+	sin.sin_family = hp->h_addrtype;
+	sin.sin_port = htons(proxyport);
+
+	if ((fd = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0)
+		return -1;
+
+	if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
+		close(fd);
+		return -1;
+	}
+
+	snprintf(cmd, sizeof(cmd), "CONNECT %s:%d HTTP/1.1\n\r\n\r", host, port);
 
-        /* we keep the real host name for the Connect command */
-        proxy_realhost = (char *) strdup(host);
-        
-        return (gethostbyname(proxy_host));
-    
+	if (send(fd, cmd, strlen(cmd),0) < 0)
+		return -1;
+	if (proxy_recv_line(fd, &inputline) < 0)
+		return -1;
+
+	if ((memcmp(HTTP_GOODSTRING, inputline, strlen(HTTP_GOODSTRING) == 0) ||
+			(memcmp(HTTP_GOODSTRING2, inputline, strlen(HTTP_GOODSTRING2) == 0)))) {
+		while (strlen(inputline) > 1) {
+			free(inputline);
+			if (proxy_recv_line(fd, &inputline) < 0)
+				return -1;
+		}
+		free(inputline);
+		return fd;
+	}
+
+	free(inputline);
+
+	close(fd);
+
+	return -1;
 }
 
-
-int proxy_connect(int  sockfd, struct sockaddr *serv_addr, int
-                  addrlen )
+static int proxy_connect_socks4(char *host, unsigned short port,
+                                char *proxyhost, unsigned short proxyport)
 {
-        struct sockaddr_in name;
-        int ret;
+	struct sockaddr_in sin;
+	unsigned char packet[12];
+	struct hostent *hp;
+	int fd = -1;
 
-        switch (proxy_type) {
-        case PROXY_NONE:
-                /* normal use */
-                return (connect(sockfd,serv_addr,addrlen));
-                break;
-        case PROXY_HTTP:  /* Http proxy */
-                /* do the  tunneling */
-                /* step one : connect to  proxy */
-                {
-                        struct hostent *hostinfo;
-                        unsigned short shortport = proxy_port;
+	debug_printf("connecting to %s:%d via %s:%d using SOCKS4\n", host, port, proxyhost, proxyport);
 
-                        memset (&name, 0, sizeof (name));
-                        name.sin_family = AF_INET;
-                        name.sin_port = htons (shortport);
-                        hostinfo = gethostbyname (proxy_host);
-                        if (hostinfo == NULL) {
-                                fprintf (stderr, "Unknown host %s.\n", proxy_host);
-                                return (-1);
-                        }
-                        name.sin_addr = *(struct in_addr *) hostinfo->h_addr;
-                }
-                sprintf(debug_buff,"Trying to connect ...\n");
-                debug_print(debug_buff);
-                if ((ret = connect(sockfd,(struct sockaddr *)&name,sizeof(name)))<0)
-                        return(ret);
-    
-                /* step two : do  proxy tunneling init */
-                {
-                        char cmd[80];
-                        char *inputline;
-                        unsigned short realport=ntohs(((struct sockaddr_in *)serv_addr)->sin_port);
-                        sprintf(cmd,"CONNECT %s:%d HTTP/1.1\n\r\n\r",proxy_realhost,realport);
-                        sprintf(debug_buff,"<%s>\n",cmd);
-                        debug_print(debug_buff);
-                        if (send(sockfd,cmd,strlen(cmd),0)<0)
-                                return(-1);
-                        if (proxy_recv_line(sockfd,&inputline) < 0) {
-                                return(-1);
-                        }
-                        sprintf(debug_buff,"<%s>\n",inputline);
-                        debug_print(debug_buff);
-                        if (memcmp("HTTP/1.0 200 Connection established",inputline,35))
-                                if (memcmp("HTTP/1.1 200 Connection established",inputline,35)) {
-                                        free(inputline);
-                                        return(-1);
-                                }
+	if (!(hp = gethostbyname(proxyhost))) 
+		return -1;
 
-                        while (strlen(inputline)>1) {
-                                free(inputline);
-                                if (proxy_recv_line(sockfd,&inputline) < 0) {
-                                        return(-1);
-                                }
-                                sprintf(debug_buff,"<%s>\n",inputline);
-                                debug_print(debug_buff);
-                        }
-                        free(inputline);
-                }
-	        
-                return 0;
-                break;
-        case PROXY_SOCKS4:
-		/* code shamelessly stolen from everybuddy */
-	{
-		struct sockaddr_in sa;
-		unsigned char packet[12];
-		struct hostent *hp;
-
-		debug_print("connecting with socks4.\n");
-
-		if (!(hp = gethostbyname(proxy_host)))
-			return -1;
+	memset(&sin, 0, sizeof(struct sockaddr_in));
+	memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length);
+	sin.sin_family = hp->h_addrtype;
+	sin.sin_port = htons(proxyport);
 
-		bzero(&sa, sizeof(sa));
-		sa.sin_family = AF_INET;
-		sa.sin_port = htons(proxy_port);
-		bcopy(hp->h_addr, (char *) &sa.sin_addr, hp->h_length);
+	if ((fd = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0)
+		return -1;
 
-		if (connect(sockfd, (struct sockaddr *) &sa, sizeof (sa)) != -1) {
-			unsigned short realport = htons(((struct sockaddr_in *)serv_addr)->sin_port);
-			
-			if (!(hp = gethostbyname(proxy_realhost)))
-				return -1;
-			packet[0] = 4;
-			packet[1] = 1;
-			packet[2] = (((unsigned short) realport) >> 8);
-			packet[3] = (((unsigned short) realport) & 0xff);
-			packet[4] = (unsigned char) (hp->h_addr_list[0])[0];
-			packet[5] = (unsigned char) (hp->h_addr_list[0])[1];
-			packet[6] = (unsigned char) (hp->h_addr_list[0])[2];
-			packet[7] = (unsigned char) (hp->h_addr_list[0])[3];
-			packet[8] = 0;
-			if (write(sockfd, packet, 9) == 9) {
-				bzero(packet, sizeof(packet));
-				if (read(sockfd, packet, 9) >= 4 && packet[1] == 90)
-					return 0;
-			}
-			close(sockfd);
-		}
+	if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
+		close(fd);
 		return -1;
 	}
-		break;
-	case PROXY_SOCKS5:
-	{
-		struct sockaddr_in sin;
-		struct hostent *hostinfo;
-		char buff[11];
 
-		sethostent(0);
-		hostinfo = gethostbyname(proxy_host);
-		if (!hostinfo) return -1;
-
-		sin.sin_addr.s_addr = atol(hostinfo->h_addr);
-		sin.sin_family = AF_INET;
-		sin.sin_port = htons(proxy_port);
-
-		if (connect(sockfd, (struct sockaddr *)&sin, sizeof(sin)) < 0)
-			return -1;
-
-		buff[0] = 5;
-		buff[1] = 1;
-		buff[2] = 0;
-
-		write(sockfd, buff, 3);
-		read(sockfd, buff, 2);
-
-		if (buff[1]) return -1;
+	/* XXX does socks4 not support host name lookups by the proxy? */
+	if (!(hp = gethostbyname(host)))
+		return -1;
 
-		hostinfo = gethostbyname(proxy_realhost);
-		if (!hostinfo) return -1;
-
-		buff[0] = 5;
-		buff[1] = 1;
-		buff[2] = 0;
-		buff[3] = 1;
-		buff[4] = (unsigned char) (hostinfo->h_addr_list[0])[0];
-		buff[5] = (unsigned char) (hostinfo->h_addr_list[0])[1];
-		buff[6] = (unsigned char) (hostinfo->h_addr_list[0])[2];
-		buff[7] = (unsigned char) (hostinfo->h_addr_list[0])[3];
-		memcpy(buff+8, &((struct sockaddr_in *)serv_addr)->sin_port, 2);
+	packet[0] = 4;
+	packet[1] = 1;
+	packet[2] = (((unsigned short) htons(port)) >> 8);
+	packet[3] = (((unsigned short) htons(port)) & 0xff);
+	packet[4] = (unsigned char) (hp->h_addr_list[0])[0];
+	packet[5] = (unsigned char) (hp->h_addr_list[0])[1];
+	packet[6] = (unsigned char) (hp->h_addr_list[0])[2];
+	packet[7] = (unsigned char) (hp->h_addr_list[0])[3];
+	packet[8] = 0;
+	if (write(fd, packet, 9) == 9) {
+		memset(packet, 0, sizeof(packet));
+		if (read(fd, packet, 9) >= 4 && packet[1] == 90)
+			return fd;
+	}
+	close(fd);
 
-		write(sockfd, buff, 10);
-		read(sockfd, buff, 10);
-
-		if (buff[1]) return -1;
-
-		return 0;
-	}
-		break;
-        default:
-                fprintf(stderr,"Unknown proxy type : %d.\n",proxy_type);
-                break;
-        }
-        return(-1);
+	return -1;
 }
 
+static int proxy_connect_socks5(char *host, unsigned short port,
+                                char *proxyhost, unsigned short proxyport)
+{
+	int i, fd = -1;
+	unsigned char buf[512];
+	struct sockaddr_in sin;
+	struct hostent *hp;
+
+	debug_printf("connecting to %s:%d via %s:%d using SOCKS5\n", host, port, proxyhost, proxyport);
+
+	if (!(hp = gethostbyname(proxyhost))) 
+		return -1;
+
+	memset(&sin, 0, sizeof(struct sockaddr_in));
+	memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length);
+	sin.sin_family = hp->h_addrtype;
+	sin.sin_port = htons(proxyport);
+
+	if ((fd = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0)
+		return -1;
+
+	if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
+		close(fd);
+		return -1;
+	}
+
+	i = 0;
+	buf[0] = 0x05; /* SOCKS version 5 */
+	buf[1] = 0x01;
+	buf[2] = 0x00;
+	i = 3;
+
+	if (write(fd, buf, i) < i) {
+		close(fd);
+		return -1;
+	}
+
+	if (read(fd, buf, 2) < 2) {
+		close(fd);
+		return -1;
+	}
+
+	if ((buf[0] != 0x05) || (buf[1] == 0xff)) {
+		close(fd);
+		return -1;
+	}
+
+	buf[0] = 0x05;
+	buf[1] = 0x01; /* CONNECT */
+	buf[2] = 0x00; /* reserved */
+	buf[3] = 0x03; /* address type -- host name */
+	buf[4] = strlen(host);
+	memcpy(buf+5, host, strlen(host));
+	buf[5+strlen(host)] = htons(port) >> 8;
+	buf[5+strlen(host)+1] = htons(port) & 0xff;
+
+	if (write(fd, buf, (5+strlen(host)+2)) < (5+strlen(host)+2)) {
+		close(fd);
+		return -1;
+	}
+	if (read(fd, buf, 10) < 10) {
+		close(fd);
+		return -1;
+	}
+	if ((buf[0] != 0x05) || (buf[1] != 0x00)) {
+		close(fd);
+		return -1;
+	}
+
+	return fd;
+}
+
+int proxy_connect(char *host, int port, char *proxyhost, int proxyport, int proxytype)
+{
+	if (!host || !port || (port == -1))
+		return -1;
+	else if ((proxytype == PROXY_NONE) || 
+			!proxyhost || !proxyhost[0] ||
+			!proxyport || (proxyport == -1))
+		return proxy_connect_none(host, port);
+	else if (proxytype == PROXY_HTTP)
+		return proxy_connect_http(host, port, proxyhost, proxyport);
+	else if (proxytype == PROXY_SOCKS4)
+		return proxy_connect_socks4(host, port, proxyhost, proxyport);
+	else if (proxytype == PROXY_SOCKS5)
+		return proxy_connect_socks5(host, port, proxyhost, proxyport);
+	return -1;
+}
--- a/src/proxy.h	Sun Nov 12 14:14:12 2000 +0000
+++ b/src/proxy.h	Sun Nov 12 23:54:07 2000 +0000
@@ -36,16 +36,6 @@
 #define PROXY_SOCKS4 2
 #define PROXY_SOCKS5 3
 
-/* masking gethostbyname function */
-extern struct hostent * proxy_gethostbyname(char *host) ;
-
-/* masking connect function */
-extern int proxy_connect(int  sockfd, struct sockaddr *serv_addr, int
-			 addrlen ) ;
-
-extern int proxy_type;
-extern char proxy_host[256];
-extern int proxy_port;
-extern char *proxy_realhost;
+extern int proxy_connect(char *host, int port, char *proxyhost, int proxyport, int proxytype);
 
 #endif
--- a/src/rvous.c	Sun Nov 12 14:14:12 2000 +0000
+++ b/src/rvous.c	Sun Nov 12 23:54:07 2000 +0000
@@ -234,8 +234,9 @@
 	ft->window = NULL;
 	serv_rvous_accept(ft->gc, ft->user, ft->cookie, ft->UID);
 
-	
-	ft->fd = connect_address(inet_addr(ft->ip), ft->port);
+
+	/* XXX is ft->port in host order or network order? */
+	ft->fd = proxy_connect(ft->ip, ft->port, NULL, NULL, -1);
 
 	if (ft->fd <= -1) {
 		fclose(ft->f);
@@ -513,8 +514,8 @@
 	serv_rvous_accept(ft->gc, ft->user, ft->cookie, ft->UID);
 
 
-
-	ft->fd = connect_address(inet_addr(ft->ip), ft->port);
+	/* XXX is ft->port in host order or network order? */
+	ft->fd = proxy_connect(ft->ip, ft->port, NULL, NULL, -1);
 
 	if (ft->fd <= -1) {
 		free_ft(ft);
--- a/src/toc.c	Sun Nov 12 14:14:12 2000 +0000
+++ b/src/toc.c	Sun Nov 12 23:54:07 2000 +0000
@@ -39,6 +39,7 @@
 #include "multi.h"
 #include "gaim.h"
 #include "gnome_applet_mgr.h"
+#include "proxy.h"
 
 #include "pixmaps/admin_icon.xpm"
 #include "pixmaps/aol_icon.xpm"
@@ -46,7 +47,7 @@
 #include "pixmaps/dt_icon.xpm"
 #include "pixmaps/free_icon.xpm"
 
-#define REVISION "gaim:$Revision: 1061 $"
+#define REVISION "gaim:$Revision: 1097 $"
 
 struct toc_data {
 	int toc_fd;
@@ -62,7 +63,12 @@
 
 static int toc_signon(struct gaim_connection *);
 
-
+/* constants to identify proto_opts */
+#define USEROPT_AUTH      0
+#define USEROPT_AUTHPORT  1
+#define USEROPT_SOCKSHOST 2
+#define USEROPT_SOCKSPORT 3
+#define USEROPT_PROXYTYPE 4
 
 /* ok. this function used to take username/password, and return 0 on success.
  * now, it takes username/password, and returns NULL on error or a new gaim_connection
@@ -70,7 +76,6 @@
 void toc_login(struct aim_user *user)
 {
 	char *config;
-        struct in_addr *sin;
 	struct gaim_connection *gc;
 	struct toc_data *tdt;
 	char buf[80];
@@ -84,34 +89,20 @@
 	while (gtk_events_pending())
 		gtk_main_iteration();
 
-	sin = (struct in_addr *)get_address(aim_host);
-	if (!sin) {
-		g_snprintf(buf, sizeof(buf), "Unable to lookup %s", aim_host);
-		hide_login_progress(gc, buf);
-		destroy_gaim_conn(gc);
-		return;
-	}
-	
-	g_snprintf(toc_addy, sizeof(toc_addy), "%s", inet_ntoa(*sin));
-	g_snprintf(buf, sizeof(buf), "Connecting to %s", inet_ntoa(*sin));
-	set_login_progress(gc, 2, buf);
-	while (gtk_events_pending())
-		gtk_main_iteration();
-	
-
-
-	tdt->toc_fd = connect_address(sin->s_addr, aim_port);
+	tdt->toc_fd = proxy_connect(
+		user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST,
+		user->proto_opt[USEROPT_AUTHPORT][0] ? atoi(user->proto_opt[USEROPT_AUTHPORT]) : TOC_PORT,
+		user->proto_opt[USEROPT_SOCKSHOST], atoi(user->proto_opt[USEROPT_SOCKSPORT]),
+		atoi(user->proto_opt[USEROPT_PROXYTYPE]));
 
         if (tdt->toc_fd < 0) {
 		g_snprintf(buf, sizeof(buf), "Connect to %s failed",
-			 inet_ntoa(*sin));
+			 user->proto_opt[USEROPT_AUTH]);
 		hide_login_progress(gc, buf);
 		destroy_gaim_conn(gc);
 		return;
         }
 
-        g_free(sin);
-	
 	g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username);
 	set_login_progress(gc, 3, buf);
 	while (gtk_events_pending())
@@ -462,9 +453,7 @@
 
 
 		g_snprintf(tmp, sizeof(tmp), "http://%s:%d/%s", toc_addy, aim_port, url);
-/*		fprintf(stdout, "Name: %s\n%s\n", name, url);
-		printf("%s", grab_url(tmp));*/
-		g_show_info(tmp);
+		g_show_info(gc->user, tmp);
         } else if (!strcasecmp(c, "EVILED")) {
                 int lev;
 		char *name = NULL;
@@ -729,7 +718,8 @@
 	
 	g_snprintf(buf, sizeof(buf), 
 		"toc_signon %s %d %s %s %s \"%s\"",
-		login_host, login_port, normalize(gc->username), roast_password(gc->password), LANGUAGE, REVISION);
+		AUTH_HOST, AUTH_PORT, normalize(gc->username), roast_password(gc->password),
+		LANGUAGE, REVISION);
 
         sprintf(debug_buff,"Send: %s\n", buf);
 		debug_print(debug_buff);
@@ -1142,11 +1132,176 @@
 	gtk_widget_show(button);
 }
 
+static void toc_print_option(GtkEntry *entry, struct aim_user *user) {
+	int entrynum;
+
+	entrynum = (int) gtk_object_get_user_data(GTK_OBJECT(entry));
+
+	if (entrynum == USEROPT_AUTH) {
+		g_snprintf(user->proto_opt[USEROPT_AUTH],
+				sizeof(user->proto_opt[USEROPT_AUTH]), 
+				"%s", gtk_entry_get_text(entry));
+	} else if (entrynum == USEROPT_AUTHPORT) {
+		g_snprintf(user->proto_opt[USEROPT_AUTHPORT], 
+				sizeof(user->proto_opt[USEROPT_AUTHPORT]), 
+				"%s", gtk_entry_get_text(entry));
+	} else if (entrynum == USEROPT_SOCKSHOST) {
+		g_snprintf(user->proto_opt[USEROPT_SOCKSHOST], 
+				sizeof(user->proto_opt[USEROPT_SOCKSHOST]), 
+				"%s", gtk_entry_get_text(entry));
+	} else if (entrynum == USEROPT_SOCKSPORT) {
+		g_snprintf(user->proto_opt[USEROPT_SOCKSPORT], 
+				sizeof(user->proto_opt[USEROPT_SOCKSPORT]), 
+				"%s", gtk_entry_get_text(entry));
+	} 
+}
+
+static void toc_print_optionrad(GtkRadioButton *entry, struct aim_user *user) {
+	int entrynum;
+
+	entrynum = (int) gtk_object_get_user_data(GTK_OBJECT(entry));
+
+	g_snprintf(user->proto_opt[USEROPT_PROXYTYPE],
+			sizeof(user->proto_opt[USEROPT_PROXYTYPE]),
+			"%d", entrynum);
+}
+
+static void toc_user_opts(GtkWidget *book, struct aim_user *user) {
+	/* so here, we create the new notebook page */
+	GtkWidget *vbox;
+	GtkWidget *hbox;
+	GtkWidget *label;
+	GtkWidget *entry;
+	GtkWidget *first, *opt;
+
+	vbox = gtk_vbox_new(FALSE, 0);
+	gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox,
+			gtk_label_new("TOC Options"));
+	gtk_widget_show(vbox);
+
+
+	hbox = gtk_hbox_new(FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
+	gtk_widget_show(hbox);
+
+	label = gtk_label_new("TOC Host:");
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+	gtk_widget_show(label);
+
+	entry = gtk_entry_new();
+	gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 5);
+	gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_AUTH);
+	gtk_signal_connect(GTK_OBJECT(entry), "changed",
+			   GTK_SIGNAL_FUNC(toc_print_option), user);
+	if (user->proto_opt[USEROPT_AUTH][0]) {
+		debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTH]);
+		gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTH]);
+	} else
+		gtk_entry_set_text(GTK_ENTRY(entry), "toc.oscar.aol.com");
+	gtk_widget_show(entry);
+
+	hbox = gtk_hbox_new(FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
+	gtk_widget_show(hbox);
+
+
+	label = gtk_label_new("TOC Port:");
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+	gtk_widget_show(label);
+
+	entry = gtk_entry_new();
+	gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 5);
+	gtk_object_set_user_data(GTK_OBJECT(entry), (void *)1);
+	gtk_signal_connect(GTK_OBJECT(entry), "changed",
+			   GTK_SIGNAL_FUNC(toc_print_option), user);
+	if (user->proto_opt[USEROPT_AUTHPORT][0]) {
+		debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTHPORT]);
+		gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTHPORT]);
+	} else
+		gtk_entry_set_text(GTK_ENTRY(entry), "9898");
+
+	gtk_widget_show(entry);
+
+
+	hbox = gtk_hbox_new(FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
+	gtk_widget_show(hbox);
+
+	label = gtk_label_new("Proxy Host:");
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+	gtk_widget_show(label);
+
+	entry = gtk_entry_new();
+	gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 5);
+	gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSHOST);
+	gtk_signal_connect(GTK_OBJECT(entry), "changed",
+			   GTK_SIGNAL_FUNC(toc_print_option), user);
+	if (user->proto_opt[USEROPT_SOCKSHOST][0]) {
+		debug_printf("setting text %s\n", user->proto_opt[USEROPT_SOCKSHOST]);
+		gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_SOCKSHOST]);
+	}
+	gtk_widget_show(entry);
+
+
+	hbox = gtk_hbox_new(FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
+	gtk_widget_show(hbox);
+
+	label = gtk_label_new("Proxy Port:");
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+	gtk_widget_show(label);
+
+	entry = gtk_entry_new();
+	gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 5);
+	gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSPORT);
+	gtk_signal_connect(GTK_OBJECT(entry), "changed",
+			   GTK_SIGNAL_FUNC(toc_print_option), user);
+	if (user->proto_opt[USEROPT_SOCKSPORT][0]) {
+		debug_printf("setting text %s\n", user->proto_opt[USEROPT_SOCKSPORT]);
+		gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_SOCKSPORT]);
+	}
+	gtk_widget_show(entry);
+
+	
+	first = gtk_radio_button_new_with_label(NULL, "No proxy");
+	gtk_box_pack_start(GTK_BOX(vbox), first, FALSE, FALSE, 0);
+	gtk_object_set_user_data(GTK_OBJECT(first), (void *)PROXY_NONE);
+	gtk_signal_connect(GTK_OBJECT(first), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user);
+	gtk_widget_show(first);
+	if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_NONE)
+		gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(first), TRUE);
+
+	opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 4");
+	gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0);
+	gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS4);
+	gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user);
+	gtk_widget_show(opt);
+	if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS4)
+		gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
+
+	opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 5");
+	gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0);
+	gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS5);
+	gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user);
+	gtk_widget_show(opt);
+	if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS5)
+		gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
+
+	opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "HTTP");
+	gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0);
+	gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_HTTP);
+	gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user);
+	gtk_widget_show(opt);
+	if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_HTTP)
+		gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
+}
+
 void toc_init(struct prpl *ret) {
         ret->protocol = PROTO_TOC;
         ret->name = toc_name;
 	ret->list_icon = toc_list_icon;
 	ret->action_menu = toc_action_menu;
+	ret->user_opts = toc_user_opts;
         ret->login = toc_login;
         ret->close = toc_close;
         ret->send_im = toc_send_im;
--- a/src/util.c	Sun Nov 12 14:14:12 2000 +0000
+++ b/src/util.c	Sun Nov 12 23:54:07 2000 +0000
@@ -730,39 +730,6 @@
         return NULL;
 }
 
-void check_gaim_versions()
-{
-	char *cur_ver;
-	char *tmp;
-
-	tmp = (char *)malloc(BUF_LONG);
-
-	cur_ver = (char *)grab_url("http://www.marko.net/gaim/latest-gaim");
-
-	if (!strncasecmp(cur_ver, "g00", 3))
-	{
-		g_free(cur_ver);
-		g_free(tmp);
-		return;
-	}
-
-	g_snprintf(tmp, BUF_LONG, "%s", strstr(cur_ver, "plain")+9);
-	g_strchomp(tmp);
-
-	if (strcmp(tmp, latest_ver))
-	{
-		g_snprintf(cur_ver, BUF_LONG, "GAIM v%s is now available.\n\nDownload it at http://www.marko.net/gaim\n", tmp);
-	
-		do_error_dialog(cur_ver, "GAIM - New Version!");
-		strcpy(latest_ver, tmp);
-		save_prefs();
-	}
-
-	free(tmp);
-	free(cur_ver);
-}
-
-
 /*  
 
 This function was taken from EveryBuddy and was written by