Mercurial > pidgin.yaz
changeset 1843:4dbd8533d209
[gaim-migrate @ 1853]
http can be authenticated
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 12 May 2001 08:09:54 +0000 |
parents | 1d137dde946f |
children | 9845deede1e9 |
files | plugins/irc.c src/gaim.h src/gaimrc.c src/html.c src/proxy.c src/proxy.h src/toc.c src/util.c |
diffstat | 8 files changed, 255 insertions(+), 78 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/irc.c Sat May 12 06:42:02 2001 +0000 +++ b/plugins/irc.c Sat May 12 08:09:54 2001 +0000 @@ -51,6 +51,8 @@ #define USEROPT_PROXYSERV 2 #define USEROPT_PROXYPORT 3 #define USEROPT_PROXYTYPE 4 +#define USEROPT_USER 5 +#define USEROPT_PASS 6 static int chat_id = 0; @@ -1227,7 +1229,9 @@ idata->fd = proxy_connect(user->proto_opt[USEROPT_SERV], user->proto_opt[USEROPT_PORT][0] ? atoi(user->proto_opt[USEROPT_PORT]) : 6667, user->proto_opt[USEROPT_PROXYSERV], atoi(user->proto_opt[USEROPT_PROXYPORT]), - atoi(user->proto_opt[USEROPT_PROXYTYPE]), irc_login_callback, gc); + atoi(user->proto_opt[USEROPT_PROXYTYPE]), + user->proto_opt[USEROPT_USER], user->proto_opt[USEROPT_PASS], + irc_login_callback, gc); if (idata->fd < 0) { hide_login_progress(gc, "Unable to create socket"); signoff(gc); @@ -1253,6 +1257,12 @@ } else if (entrynum == USEROPT_PROXYPORT) { g_snprintf(user->proto_opt[USEROPT_PROXYPORT], sizeof(user->proto_opt[USEROPT_PROXYPORT]), "%s", gtk_entry_get_text(entry)); + } else if (entrynum == USEROPT_USER) { + g_snprintf(user->proto_opt[USEROPT_USER], + sizeof(user->proto_opt[USEROPT_USER]), "%s", gtk_entry_get_text(entry)); + } else if (entrynum == USEROPT_PASS) { + g_snprintf(user->proto_opt[USEROPT_PASS], + sizeof(user->proto_opt[USEROPT_PASS]), "%s", gtk_entry_get_text(entry)); } } @@ -1309,15 +1319,57 @@ entry = gtk_entry_new(); gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PORT); + gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); if (user->proto_opt[USEROPT_PORT][0]) { debug_printf("setting text %s\n", user->proto_opt[USEROPT_PORT]); gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PORT]); - } else { - gtk_entry_set_text(GTK_ENTRY(entry), "6667"); - } - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); + } else + gtk_entry_set_text(GTK_ENTRY(entry), "9898"); + gtk_widget_show(entry); + hbox = gtk_hbox_new(TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_widget_show(hbox); + + first = gtk_radio_button_new_with_label(NULL, "No proxy"); + gtk_box_pack_start(GTK_BOX(hbox), 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(irc_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(hbox), 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(irc_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); + + hbox = gtk_hbox_new(TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_widget_show(hbox); + + opt = + gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 5"); + gtk_box_pack_start(GTK_BOX(hbox), 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(irc_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(hbox), 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(irc_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); + hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); @@ -1354,39 +1406,42 @@ } 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(irc_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); + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_widget_show(hbox); + + label = gtk_label_new("HTTP User:"); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); - 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(irc_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); + entry = gtk_entry_new(); + gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); + gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_USER); + gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); + if (user->proto_opt[USEROPT_USER][0]) { + debug_printf("setting text %s\n", user->proto_opt[USEROPT_USER]); + gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_USER]); + } + gtk_widget_show(entry); - 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(irc_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); + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_widget_show(hbox); + + label = gtk_label_new("HTTP Password:"); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); - 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(irc_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); + entry = gtk_entry_new(); + gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); + gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); + gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PASS); + gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); + if (user->proto_opt[USEROPT_PASS][0]) { + debug_printf("setting text %s\n", user->proto_opt[USEROPT_PASS]); + gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PASS]); + } + gtk_widget_show(entry); } static char **irc_list_icon(int uc)
--- a/src/gaim.h Sat May 12 06:42:02 2001 +0000 +++ b/src/gaim.h Sat May 12 08:09:54 2001 +0000 @@ -124,7 +124,7 @@ int protocol; /* prpls can use this to save information about the user, * like which server to connect to, etc */ - char proto_opt[6][256]; + char proto_opt[7][256]; struct gaim_connection *gc; @@ -601,6 +601,7 @@ extern int escape_text(char *); extern char *escape_text2(char *); extern int escape_message(char *msg); +extern char *tobase64(char *); extern char *frombase64(char *); extern gint clean_pid(void *); extern char *date();
--- a/src/gaimrc.c Sat May 12 06:42:02 2001 +0000 +++ b/src/gaimrc.c Sat May 12 08:09:54 2001 +0000 @@ -523,7 +523,7 @@ if (strcmp(p->option, "proto_opts")) return u; - for (i = 0; i < 6; i++) + for (i = 0; i < 7; i++) g_snprintf(u->proto_opt[i], sizeof u->proto_opt[i], "%s", p->value[i]); return u; @@ -558,7 +558,7 @@ fprintf(f, "\n\t\t}\n"); fprintf(f, "\t\tuser_opts { %d } { %d }\n", u->options, u->protocol); fprintf(f, "\t\tproto_opts"); - for (i = 0; i < 6; i++) + for (i = 0; i < 7; i++) fprintf(f, " { %s }", u->proto_opt[i]); fprintf(f, "\n"); }
--- a/src/html.c Sat May 12 06:42:02 2001 +0000 +++ b/src/html.c Sat May 12 08:09:54 2001 +0000 @@ -226,6 +226,7 @@ if ((sock = proxy_connect(gunk->website.address, gunk->website.port, user->proto_opt[2], atoi(user->proto_opt[3]), atoi(user->proto_opt[4]), + user->proto_opt[5], user->proto_opt[6], grab_url_callback, gunk)) < 0) { g_free(gunk->url); g_free(gunk); @@ -233,7 +234,7 @@ } } else { if ((sock = proxy_connect(gunk->website.address, gunk->website.port, NULL, 0, -1, - grab_url_callback, gunk)) < 0) { + NULL, NULL, grab_url_callback, gunk)) < 0) { g_free(gunk->url); g_free(gunk); callback(data, g_strdup(_("g003: Error opening connection.\n")));
--- a/src/proxy.c Sat May 12 06:42:02 2001 +0000 +++ b/src/proxy.c Sat May 12 08:09:54 2001 +0000 @@ -45,6 +45,8 @@ gpointer data; char *host; int port; + char *user; + char *pass; gint inpa; }; @@ -142,6 +144,10 @@ if ((memcmp(HTTP_GOODSTRING , inputline, strlen(HTTP_GOODSTRING )) == 0) || (memcmp(HTTP_GOODSTRING2, inputline, strlen(HTTP_GOODSTRING2)) == 0)) { phb->func(phb->data, source, GDK_INPUT_READ); + if (phb->user) { + g_free(phb->user); + g_free(phb->pass); + } g_free(phb->host); g_free(phb); return; @@ -149,6 +155,10 @@ close(source); phb->func(phb->data, -1, GDK_INPUT_READ); + if (phb->user) { + g_free(phb->user); + g_free(phb->pass); + } g_free(phb->host); g_free(phb); return; @@ -166,16 +176,55 @@ if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(source); phb->func(phb->data, -1, GDK_INPUT_READ); + if (phb->user) { + g_free(phb->user); + g_free(phb->pass); + } g_free(phb->host); g_free(phb); return; } fcntl(source, F_SETFL, 0); - snprintf(cmd, sizeof(cmd), "CONNECT %s:%d HTTP/1.1\r\n\r\n", phb->host, phb->port); + g_snprintf(cmd, sizeof(cmd), "CONNECT %s:%d HTTP/1.1\r\n", phb->host, phb->port); if (send(source, cmd, strlen(cmd), 0) < 0) { close(source); phb->func(phb->data, -1, GDK_INPUT_READ); + if (phb->user) { + g_free(phb->user); + g_free(phb->pass); + } + g_free(phb->host); + g_free(phb); + return; + } + + if (phb->user) { + char *t1, *t2; + t1 = g_strdup_printf("%s:%s", phb->user, phb->pass); + t2 = tobase64(t1); + g_free(t1); + g_snprintf(cmd, sizeof(cmd), "Proxy-Authorization: Basic %s\r\n", t2); + g_free(t2); + if (send(source, cmd, strlen(cmd), 0) < 0) { + close(source); + phb->func(phb->data, -1, GDK_INPUT_READ); + g_free(phb->user); + g_free(phb->pass); + g_free(phb->host); + g_free(phb); + return; + } + } + + g_snprintf(cmd, sizeof(cmd), "\r\n"); + if (send(source, cmd, strlen(cmd), 0) < 0) { + close(source); + phb->func(phb->data, -1, GDK_INPUT_READ); + if (phb->user) { + g_free(phb->user); + g_free(phb->pass); + } g_free(phb->host); g_free(phb); return; @@ -186,6 +235,7 @@ static int proxy_connect_http(char *host, unsigned short port, char *proxyhost, unsigned short proxyport, + char *user, char *pass, struct PHB *phb) { struct hostent *hp; @@ -211,6 +261,10 @@ phb->host = g_strdup(host); phb->port = port; + if (user && pass && user[0] && pass[0]) { + phb->user = g_strdup(user); + phb->pass = g_strdup(pass); + } fcntl(fd, F_SETFL, O_NONBLOCK); if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { @@ -219,6 +273,10 @@ phb->inpa = gdk_input_add(fd, GDK_INPUT_WRITE, http_canwrite, phb); } else { close(fd); + if (phb->user) { + g_free(phb->user); + g_free(phb->pass); + } g_free(phb->host); g_free(phb); return -1; @@ -229,6 +287,10 @@ len = sizeof(error); if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(fd); + if (phb->user) { + g_free(phb->user); + g_free(phb->pass); + } g_free(phb->host); g_free(phb); return -1; @@ -536,6 +598,7 @@ int proxy_connect(char *host, int port, char *proxyhost, int proxyport, int proxytype, + char *user, char *pass, GdkInputFunction func, gpointer data) { struct PHB *phb = g_new0(struct PHB, 1); @@ -552,7 +615,7 @@ !proxyport || (proxyport == -1)) return proxy_connect_none(host, port, phb); else if (proxytype == PROXY_HTTP) - return proxy_connect_http(host, port, proxyhost, proxyport, phb); + return proxy_connect_http(host, port, proxyhost, proxyport, user, pass, phb); else if (proxytype == PROXY_SOCKS4) return proxy_connect_socks4(host, port, proxyhost, proxyport, phb); else if (proxytype == PROXY_SOCKS5)
--- a/src/proxy.h Sat May 12 06:42:02 2001 +0000 +++ b/src/proxy.h Sat May 12 08:09:54 2001 +0000 @@ -39,6 +39,7 @@ extern int proxy_connect(char *host, int port, char *proxyhost, int proxyport, int proxytype, + char *user, char *pass, GdkInputFunction func, gpointer data); #endif
--- a/src/toc.c Sat May 12 06:42:02 2001 +0000 +++ b/src/toc.c Sat May 12 08:09:54 2001 +0000 @@ -118,6 +118,8 @@ #define USEROPT_PROXYHOST 2 #define USEROPT_PROXYPORT 3 #define USEROPT_PROXYTYPE 4 +#define USEROPT_USER 5 +#define USEROPT_PASS 6 static GtkWidget *join_chat_spin = NULL; static GtkWidget *join_chat_entry = NULL; @@ -151,6 +153,7 @@ user->proto_opt[USEROPT_PROXYHOST], atoi(user->proto_opt[USEROPT_PROXYPORT]), atoi(user->proto_opt[USEROPT_PROXYTYPE]), + user->proto_opt[USEROPT_USER], user->proto_opt[USEROPT_PASS], toc_login_callback, gc); if (tdt->toc_fd < 0) { @@ -1026,6 +1029,12 @@ } else if (entrynum == USEROPT_PROXYPORT) { g_snprintf(user->proto_opt[USEROPT_PROXYPORT], sizeof(user->proto_opt[USEROPT_PROXYPORT]), "%s", gtk_entry_get_text(entry)); + } else if (entrynum == USEROPT_USER) { + g_snprintf(user->proto_opt[USEROPT_USER], + sizeof(user->proto_opt[USEROPT_USER]), "%s", gtk_entry_get_text(entry)); + } else if (entrynum == USEROPT_PASS) { + g_snprintf(user->proto_opt[USEROPT_PASS], + sizeof(user->proto_opt[USEROPT_PASS]), "%s", gtk_entry_get_text(entry)); } } @@ -1092,6 +1101,48 @@ gtk_widget_show(entry); + hbox = gtk_hbox_new(TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_widget_show(hbox); + + first = gtk_radio_button_new_with_label(NULL, "No proxy"); + gtk_box_pack_start(GTK_BOX(hbox), 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(hbox), 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); + + hbox = gtk_hbox_new(TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_widget_show(hbox); + + opt = + gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 5"); + gtk_box_pack_start(GTK_BOX(hbox), 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(hbox), 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); + hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); @@ -1128,39 +1179,42 @@ } 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); + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_widget_show(hbox); + + label = gtk_label_new("HTTP User:"); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); - 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); + entry = gtk_entry_new(); + gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); + gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_USER); + gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); + if (user->proto_opt[USEROPT_USER][0]) { + debug_printf("setting text %s\n", user->proto_opt[USEROPT_USER]); + gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_USER]); + } + gtk_widget_show(entry); - 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); + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_widget_show(hbox); + + label = gtk_label_new("HTTP Password:"); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); - 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); + entry = gtk_entry_new(); + gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); + gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); + gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PASS); + gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); + if (user->proto_opt[USEROPT_PASS][0]) { + debug_printf("setting text %s\n", user->proto_opt[USEROPT_PASS]); + gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PASS]); + } + gtk_widget_show(entry); } static void toc_add_permit(struct gaim_connection *gc, char *who) @@ -1593,6 +1647,7 @@ user->proto_opt[USEROPT_PROXYHOST], atoi(user->proto_opt[USEROPT_PROXYPORT]), atoi(user->proto_opt[USEROPT_PROXYTYPE]), + user->proto_opt[USEROPT_USER], user->proto_opt[USEROPT_PASS], toc_send_file_connect, ft); if (fd < 0) { do_error_dialog(_("Could not connect for transfer!"), _("Error")); @@ -1817,6 +1872,7 @@ user->proto_opt[USEROPT_PROXYHOST], atoi(user->proto_opt[USEROPT_PROXYPORT]), atoi(user->proto_opt[USEROPT_PROXYTYPE]), + user->proto_opt[USEROPT_USER], user->proto_opt[USEROPT_PASS], toc_get_file_connect, ft); if (fd < 0) { do_error_dialog(_("Could not connect for transfer!"), _("Error"));
--- a/src/util.c Sat May 12 06:42:02 2001 +0000 +++ b/src/util.c Sat May 12 08:09:54 2001 +0000 @@ -621,16 +621,16 @@ break; case 1: tmp <<= 16; - out = g_realloc(out, len + 4); - out[len] = alphabet[(tmp >> 12) & 0x3f]; - out[len + 1] = alphabet[(tmp >> 6) & 0x3f]; + out = g_realloc(out, len + 5); + out[len] = alphabet[(tmp >> 18) & 0x3f]; + out[len + 1] = alphabet[(tmp >> 12) & 0x3f]; out[len + 2] = '='; - out[len + 3] = 0; + out[len + 3] = '='; + out[len + 4] = 0; break; case 0: - out = g_realloc(out, len + 2); - out[len] = '='; - out[len + 1] = 0; + out = g_realloc(out, len + 1); + out[len] = 0; break; } return out;