Mercurial > pidgin
changeset 1881:a02584b98823
[gaim-migrate @ 1891]
C:)
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 23 May 2001 07:59:05 +0000 |
parents | b8245bcce7e6 |
children | 922d8505ae5a |
files | ChangeLog README plugins/icq/gaim_icq.c plugins/irc.c plugins/jabber/jabber.c plugins/msn/msn.c plugins/napster.c plugins/yay/yay.c src/buddy.c src/conversation.c src/gaim.h src/gaimrc.c src/html.c src/oscar.c src/prefs.c src/proxy.c src/proxy.h src/toc.c |
diffstat | 18 files changed, 301 insertions(+), 1344 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue May 22 23:23:28 2001 +0000 +++ b/ChangeLog Wed May 23 07:59:05 2001 +0000 @@ -13,8 +13,7 @@ * MSN can now change your 'friendly name' (Thanks for the packet logs, aechols) * More IRC improvements [colors, etc] (Thanks Sean Egan) - * Improved proxy options for TOC, IRC, MSN, Jabber, Oscar, - Napster, Yahoo + * Improved proxy options * Fixed a small issue with HTML not being stripped from log files properly (Thanks, faceprint)
--- a/README Tue May 22 23:23:28 2001 +0000 +++ b/README Wed May 23 07:59:05 2001 +0000 @@ -19,6 +19,11 @@ system. If you don't have them, it will settle for simply GTK. If you don't want Gnome bits, ./configure --disable-gnome +If you want to build as a GNOME applet: +./configure --enable-panel ; make +then su to root and run "make install". +Afterwards panel->Add applet->Network->Gaim should be there. + Run: type "./gaim" @@ -32,10 +37,10 @@ should now have another option for the protocol that you loaded. Then you can sign that account on. -If you want to build as a GNOME applet: -./configure --enable-panel ; make -then su to root and run "make install". -Afterwards panel->Add applet->Network->Gaim should be there. +ICQ and Zephyr are currently the only two protocols that don't use the +global proxy configuration; however, if you have the proxy set to use a +SOCKS5 proxy, ICQ will use it. If the proxy options aren't robust enough +for you there are several libraries that you can link gaim against. Notes: @@ -53,8 +58,8 @@ places, but the Makefile/configure script should figure things out for you. Send me bug reports. The web page is http://gaim.sourceforge.net/and the ftp -site is ftp://ftp.marko.net/pub/gaim. We also have a sourceforge page at -http://sourceforge.net/projects/gaim/ +site is ftp://ftp.sourceforge.net/pub/sourceforge/gaim. We also have a +sourceforge page at http://sourceforge.net/projects/gaim/ Keep your eyes out for updates, and I'll try to keep the program maintained. Other contributors and patches are welcomed. Please read the FAQ first.
--- a/plugins/icq/gaim_icq.c Tue May 22 23:23:28 2001 +0000 +++ b/plugins/icq/gaim_icq.c Wed May 23 07:59:05 2001 +0000 @@ -5,6 +5,7 @@ #include "multi.h" /* needed for gaim_connection */ #include "prpl.h" /* needed for prpl */ #include "gaim.h" /* needed for every other damn thing */ +#include "proxy.h" #include "pixmaps/gnomeicu-online.xpm" #include "pixmaps/gnomeicu-away.xpm" @@ -270,6 +271,9 @@ link->icq_Log = icq_do_log; link->icq_RequestNotify = icq_req_not; + if (proxytype == PROXY_SOCKS5) + icq_SetProxy(link, proxyhost, proxyport, proxyuser[0], proxyuser, proxypass); + icq_ContactClear(id->link); if (bud_list_cache_exists(gc)) do_import(NULL, gc);
--- a/plugins/irc.c Tue May 22 23:23:28 2001 +0000 +++ b/plugins/irc.c Wed May 23 07:59:05 2001 +0000 @@ -49,12 +49,6 @@ #define USEROPT_SERV 0 #define USEROPT_PORT 1 -#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; @@ -1859,9 +1853,6 @@ 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]), - user->proto_opt[USEROPT_USER], user->proto_opt[USEROPT_PASS], irc_login_callback, gc); if (!user->gc || (idata->fd < 0)) { hide_login_progress(gc, "Unable to create socket"); @@ -1882,31 +1873,9 @@ } else if (entrynum == USEROPT_PORT) { g_snprintf(user->proto_opt[USEROPT_PORT], sizeof(user->proto_opt[USEROPT_PORT]), "%s", gtk_entry_get_text(entry)); - } else if (entrynum == USEROPT_PROXYSERV) { - g_snprintf(user->proto_opt[USEROPT_PROXYSERV], - sizeof(user->proto_opt[USEROPT_PROXYSERV]), "%s", gtk_entry_get_text(entry)); - } 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)); } } -static void irc_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 irc_user_opts(GtkWidget * book, struct aim_user *user) { /* so here, we create the new notebook page */ @@ -1914,7 +1883,6 @@ GtkWidget *hbox; GtkWidget *label; GtkWidget *entry; - GtkWidget *first, *opt; vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); @@ -1958,121 +1926,6 @@ gtk_entry_set_text(GTK_ENTRY(entry), "6667"); 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); - - label = gtk_label_new("Proxy Host:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYSERV); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); - if (user->proto_opt[USEROPT_PROXYSERV][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYSERV]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYSERV]); - } - gtk_widget_show(entry); - - 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("Proxy Port:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYPORT); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); - if (user->proto_opt[USEROPT_PROXYPORT][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYPORT]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYPORT]); - } - gtk_widget_show(entry); - - 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("Proxy User:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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); - - 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("Proxy Password:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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/plugins/jabber/jabber.c Tue May 22 23:23:28 2001 +0000 +++ b/plugins/jabber/jabber.c Wed May 23 07:59:05 2001 +0000 @@ -74,12 +74,6 @@ #define DEFAULT_SERVER "jabber.org" #define DEFAULT_GROUPCHAT "conference.jabber.org" -#define USEROPT_PROXYSERV 2 -#define USEROPT_PROXYPORT 3 -#define USEROPT_PROXYTYPE 4 -#define USEROPT_USER 5 -#define USEROPT_PASS 6 - typedef struct gjconn_struct { /* Core structure */ pool p; /* Memory allocation pool */ @@ -472,11 +466,7 @@ XML_SetElementHandler(j->parser, startElement, endElement); XML_SetCharacterDataHandler(j->parser, charData); - j->fd = proxy_connect(j->user->server, 5222, - user->proto_opt[USEROPT_PROXYSERV], atoi(user->proto_opt[USEROPT_PROXYPORT]), - atoi(user->proto_opt[USEROPT_PROXYTYPE]), - user->proto_opt[USEROPT_USER], user->proto_opt[USEROPT_PASS], - gjab_connected, j); + j->fd = proxy_connect(j->user->server, 5222, gjab_connected, j); if (!user->gc || (j->fd < 0)) { STATE_EVT(JCONN_STATE_OFF) return; @@ -1909,167 +1899,6 @@ jd->idle = idle ? time(NULL) - idle : idle; } -static void jabber_print_option(GtkEntry *entry, struct aim_user *user) -{ - int entrynum; - - entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); - - if (entrynum == USEROPT_PROXYSERV) { - g_snprintf(user->proto_opt[USEROPT_PROXYSERV], - sizeof(user->proto_opt[USEROPT_PROXYSERV]), "%s", gtk_entry_get_text(entry)); - } 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)); - } -} - -static void jabber_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 jabber_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, 5); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); - gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("Jabber Options")); - gtk_widget_show(vbox); - - 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(jabber_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(jabber_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(jabber_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(jabber_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); - - label = gtk_label_new("Proxy Host:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYSERV); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(jabber_print_option), user); - if (user->proto_opt[USEROPT_PROXYSERV][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYSERV]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYSERV]); - } - gtk_widget_show(entry); - - 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("Proxy Port:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYPORT); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(jabber_print_option), user); - if (user->proto_opt[USEROPT_PROXYPORT][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYPORT]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYPORT]); - } - gtk_widget_show(entry); - - 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("Proxy User:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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(jabber_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); - - 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("Proxy Password:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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(jabber_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 struct prpl *my_protocol = NULL; void Jabber_init(struct prpl *ret) @@ -2081,7 +1910,7 @@ ret->list_icon = jabber_list_icon; ret->away_states = jabber_away_states; ret->buddy_menu = jabber_buddy_menu; - ret->user_opts = jabber_user_opts; + ret->user_opts = NULL; ret->draw_new_user = jabber_draw_new_user; ret->do_new_user = jabber_do_new_user; ret->login = jabber_login;
--- a/plugins/msn/msn.c Tue May 22 23:23:28 2001 +0000 +++ b/plugins/msn/msn.c Wed May 23 07:59:05 2001 +0000 @@ -65,12 +65,6 @@ #define MSN_SIGNON_SENT_USR 0x0002 #define USEROPT_HOTMAIL 0 -/* eventually, everything should probably use the same proxy setup, so we'll borrow this from TOC/IRC */ -#define USEROPT_PROXYSERV 2 -#define USEROPT_PROXYPORT 3 -#define USEROPT_PROXYTYPE 4 -#define USEROPT_USER 5 -#define USEROPT_PASS 6 struct mod_usr_opt { struct aim_user *user; @@ -563,12 +557,7 @@ mc->secret = g_strdup(res[4]); mc->session = g_strdup(res[1]); - mc->fd = proxy_connect(address[0], atoi(address[1]), - gc->user->proto_opt[USEROPT_PROXYSERV], - atoi(gc->user->proto_opt[USEROPT_PROXYPORT]), - atoi(gc->user->proto_opt[USEROPT_PROXYTYPE]), - gc->user->proto_opt[USEROPT_USER], gc->user->proto_opt[USEROPT_PASS], - msn_answer_callback, mc); + mc->fd = proxy_connect(address[0], atoi(address[1]), msn_answer_callback, mc); g_strfreev(address); g_strfreev(res); if (!user->gc || (mc->fd < 0)) { @@ -611,12 +600,7 @@ if (mc->inpa) gdk_input_remove(mc->inpa); - mc->fd = proxy_connect(res[0], atoi(res[1]), - gc->user->proto_opt[USEROPT_PROXYSERV], - atoi(gc->user->proto_opt[USEROPT_PROXYPORT]), - atoi(gc->user->proto_opt[USEROPT_PROXYTYPE]), - gc->user->proto_opt[USEROPT_USER], gc->user->proto_opt[USEROPT_PASS], - msn_xfr_callback, mc); + mc->fd = proxy_connect(res[0], atoi(res[1]), msn_xfr_callback, mc); g_strfreev(res); return; @@ -807,12 +791,7 @@ gc->inpa = 0; /* Now we have the host and port */ - md->fd = proxy_connect(res[0], atoi(res[1]), - gc->user->proto_opt[USEROPT_PROXYSERV], - atoi(gc->user->proto_opt[USEROPT_PROXYPORT]), - atoi(gc->user->proto_opt[USEROPT_PROXYTYPE]), - gc->user->proto_opt[USEROPT_USER], gc->user->proto_opt[USEROPT_PASS], - msn_login_callback, gc); + md->fd = proxy_connect(res[0], atoi(res[1]), msn_login_callback, gc); if (!user->gc || (md->fd < 0)) { g_strfreev(res); hide_login_progress(gc, "Error connecting to server"); @@ -914,11 +893,7 @@ md->status = 0; sprintf(gc->username, "%s", msn_normalize(gc->username)); - md->fd = proxy_connect("messenger.hotmail.com", 1863, - user->proto_opt[USEROPT_PROXYSERV], atoi(user->proto_opt[USEROPT_PROXYPORT]), - atoi(user->proto_opt[USEROPT_PROXYTYPE]), - user->proto_opt[USEROPT_USER], user->proto_opt[USEROPT_PASS], - msn_login_callback, gc); + md->fd = proxy_connect("messenger.hotmail.com", 1863, msn_login_callback, gc); if (!user->gc || (md->fd < 0)) { hide_login_progress(gc, "Error connecting to server"); signoff(gc); @@ -1219,45 +1194,10 @@ return button; } -static void msn_print_option(GtkEntry *entry, struct aim_user *user) -{ - int entrynum; - - entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); - - if (entrynum == USEROPT_PROXYSERV) { - g_snprintf(user->proto_opt[USEROPT_PROXYSERV], - sizeof(user->proto_opt[USEROPT_PROXYSERV]), "%s", gtk_entry_get_text(entry)); - } 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)); - } -} - -static void msn_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 msn_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, 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); @@ -1265,121 +1205,6 @@ gtk_widget_show(vbox); msn_protoopt_button("Notify me of new HotMail",user,USEROPT_HOTMAIL,vbox); - - 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(msn_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(msn_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(msn_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(msn_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); - - label = gtk_label_new("Proxy Host:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYSERV); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(msn_print_option), user); - if (user->proto_opt[USEROPT_PROXYSERV][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYSERV]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYSERV]); - } - gtk_widget_show(entry); - - 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("Proxy Port:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYPORT); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(msn_print_option), user); - if (user->proto_opt[USEROPT_PROXYPORT][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYPORT]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYPORT]); - } - gtk_widget_show(entry); - - 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("Proxy User:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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(msn_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); - - 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("Proxy Password:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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(msn_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); } /*
--- a/plugins/napster.c Tue May 22 23:23:28 2001 +0000 +++ b/plugins/napster.c Wed May 23 07:59:05 2001 +0000 @@ -45,12 +45,6 @@ #define NAP_BUF_LEN 4096 -#define USEROPT_PROXYHOST 2 -#define USEROPT_PROXYPORT 3 -#define USEROPT_PROXYTYPE 4 -#define USEROPT_USER 5 -#define USEROPT_PASS 6 - GSList *nap_connections = NULL; static unsigned int chat_id = 0; @@ -525,13 +519,7 @@ req->gc = gc; /* Make a connection with the server */ - req->fd = proxy_connect(host, port, - gc->user->proto_opt[USEROPT_PROXYHOST], - atoi(gc->user->proto_opt[USEROPT_PROXYPORT]), - atoi(gc->user->proto_opt[USEROPT_PROXYTYPE]), - gc->user->proto_opt[USEROPT_USER], - gc->user->proto_opt[USEROPT_PASS], - nap_get_file_connect, req); + req->fd = proxy_connect(host, port, nap_get_file_connect, req); if (req->fd < 0) { do_error_dialog("Error connecting to user", "Gaim: Napster error"); g_free(req->name); @@ -923,12 +911,7 @@ struct gaim_connection *gc = new_gaim_conn(user); struct nap_data *ndata = gc->proto_data = g_new0(struct nap_data, 1); - ndata->fd = proxy_connect("64.124.41.187", 8888, - 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], - nap_login_connect, gc); + ndata->fd = proxy_connect("64.124.41.187", 8888, nap_login_connect, gc); if (ndata->fd < 0) { hide_login_progress(gc, "Unable to connect"); signoff(gc); @@ -1185,167 +1168,6 @@ return napster_xpm; } -static void nap_print_option(GtkEntry *entry, struct aim_user *user) -{ - int entrynum; - - entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); - - if (entrynum == USEROPT_PROXYHOST) { - g_snprintf(user->proto_opt[USEROPT_PROXYHOST], - sizeof(user->proto_opt[USEROPT_PROXYHOST]), "%s", gtk_entry_get_text(entry)); - } 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)); - } -} - -static void nap_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 nap_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, 5); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); - gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("Napster Options")); - gtk_widget_show(vbox); - - 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(nap_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(nap_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(nap_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(nap_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); - - label = gtk_label_new("Proxy Host:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYHOST); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(nap_print_option), user); - if (user->proto_opt[USEROPT_PROXYHOST][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYHOST]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYHOST]); - } - gtk_widget_show(entry); - - 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("Proxy Port:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYPORT); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(nap_print_option), user); - if (user->proto_opt[USEROPT_PROXYPORT][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYPORT]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYPORT]); - } - gtk_widget_show(entry); - - 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("Proxy User:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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(nap_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); - - 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("Proxy Password:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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(nap_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 struct prpl *my_protocol = NULL; static void nap_init(struct prpl *ret) @@ -1354,7 +1176,7 @@ ret->name = nap_name; ret->list_icon = nap_list_icon; ret->buddy_menu = nap_buddy_menu; - ret->user_opts = nap_user_opts; + ret->user_opts = NULL; ret->login = nap_login; ret->close = nap_close; ret->send_im = nap_send_im;
--- a/plugins/yay/yay.c Tue May 22 23:23:28 2001 +0000 +++ b/plugins/yay/yay.c Wed May 23 07:59:05 2001 +0000 @@ -49,12 +49,6 @@ #include "pixmaps/cancel.xpm" -#define USEROPT_PROXYHOST 2 -#define USEROPT_PROXYPORT 3 -#define USEROPT_PROXYTYPE 4 -#define USEROPT_USER 5 -#define USEROPT_PASS 6 - struct conn { int socket; int type; @@ -377,18 +371,11 @@ static int yahoo_connect_to(struct yahoo_session *sess, const char *host, int port, gpointer data) { struct connect *con = g_new0(struct connect, 1); - struct gaim_connection *gc = sess->user_data; int fd; con->sess = sess; con->data = data; - fd = proxy_connect((char *)host, port, - gc->user->proto_opt[USEROPT_PROXYHOST], - atoi(gc->user->proto_opt[USEROPT_PROXYPORT]), - atoi(gc->user->proto_opt[USEROPT_PROXYTYPE]), - gc->user->proto_opt[USEROPT_USER], - gc->user->proto_opt[USEROPT_PASS], - yahoo_got_connected, con); + fd = proxy_connect((char *)host, port, yahoo_got_connected, con); if (fd < 0) { g_free(con); return -1; @@ -689,167 +676,6 @@ return m; } -static void yahoo_print_option(GtkEntry *entry, struct aim_user *user) -{ - int entrynum; - - entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); - - if (entrynum == USEROPT_PROXYHOST) { - g_snprintf(user->proto_opt[USEROPT_PROXYHOST], - sizeof(user->proto_opt[USEROPT_PROXYHOST]), "%s", gtk_entry_get_text(entry)); - } 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)); - } -} - -static void yahoo_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 yahoo_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, 5); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); - gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("Yahoo Options")); - gtk_widget_show(vbox); - - 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(yahoo_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(yahoo_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(yahoo_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(yahoo_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); - - label = gtk_label_new("Proxy Host:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYHOST); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(yahoo_print_option), user); - if (user->proto_opt[USEROPT_PROXYHOST][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYHOST]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYHOST]); - } - gtk_widget_show(entry); - - 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("Proxy Port:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYPORT); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(yahoo_print_option), user); - if (user->proto_opt[USEROPT_PROXYPORT][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYPORT]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYPORT]); - } - gtk_widget_show(entry); - - 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("Proxy User:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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(yahoo_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); - - 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("Proxy Password:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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(yahoo_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 struct prpl *my_protocol = NULL; void Yahoo_init(struct prpl *ret) { @@ -861,7 +687,7 @@ ret->actions = yahoo_actions; ret->do_action = yahoo_do_action; ret->buddy_menu = yahoo_buddy_menu; - ret->user_opts = yahoo_user_opts; + ret->user_opts = NULL; ret->login = yahoo_login; ret->close = yahoo_close; ret->send_im = yahoo_send_im;
--- a/src/buddy.c Tue May 22 23:23:28 2001 +0000 +++ b/src/buddy.c Wed May 23 07:59:05 2001 +0000 @@ -2971,7 +2971,8 @@ while (mem) { b = (struct buddy *)mem->data; pos += g_snprintf(&s[pos], len - pos, "b %s%s%s\n", b->name, - show ? ":" : "", show ? b->show : ""); + (show && strcmp(b->name, b->show)) ? ":" : "", + (show && strcmp(b->name, b->show)) ? b->show : ""); mem = mem->next; } grp = g_slist_next(grp);
--- a/src/conversation.c Tue May 22 23:23:28 2001 +0000 +++ b/src/conversation.c Wed May 23 07:59:05 2001 +0000 @@ -821,6 +821,16 @@ } } + quiet_set(c->bold, FALSE); + quiet_set(c->strike, FALSE); + quiet_set(c->italic, FALSE); + quiet_set(c->underline, FALSE); + quiet_set(c->font, FALSE); + quiet_set(c->fgcolorbtn, FALSE); + quiet_set(c->bgcolorbtn, FALSE); + quiet_set(c->link, FALSE); + gtk_widget_grab_focus(c->entry); + { char *buffy = g_strdup(buf); enum gaim_event evnt = c->is_chat ? event_chat_send : event_im_send; @@ -855,15 +865,6 @@ /* no sound because we do that when we receive our message */ } - quiet_set(c->bold, FALSE); - quiet_set(c->strike, FALSE); - quiet_set(c->italic, FALSE); - quiet_set(c->underline, FALSE); - quiet_set(c->font, FALSE); - quiet_set(c->fgcolorbtn, FALSE); - quiet_set(c->bgcolorbtn, FALSE); - quiet_set(c->link, FALSE); - if (general_options & OPT_GEN_BACK_ON_IM) { if (awaymessage != NULL) { do_im_back(); @@ -872,7 +873,6 @@ } } - gtk_widget_grab_focus(c->entry); g_free(buf2); g_free(buf); }
--- a/src/gaim.h Tue May 22 23:23:28 2001 +0000 +++ b/src/gaim.h Wed May 23 07:59:05 2001 +0000 @@ -591,7 +591,7 @@ /* Functions in html.c */ extern struct g_url parse_url(char *); -extern void grab_url(struct aim_user *, char *, void (*callback)(gpointer, char *), gpointer); +extern void grab_url(char *, void (*callback)(gpointer, char *), gpointer); extern gchar *strip_html(gchar *); /* Functions in idle.c */
--- a/src/gaimrc.c Tue May 22 23:23:28 2001 +0000 +++ b/src/gaimrc.c Wed May 23 07:59:05 2001 +0000 @@ -34,6 +34,7 @@ #include <gtk/gtk.h> #include "gaim.h" #include "prpl.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" @@ -156,6 +157,8 @@ return 5; } else if (!strcmp(tag, "sound_files")) { return 6; + } else if (!strcmp(tag, "proxy")) { + return 7; } return -1; @@ -768,6 +771,47 @@ fprintf(f, "}\n"); } +static void gaimrc_read_proxy(FILE *f) +{ + char buf[2048]; + struct parse *p; + + buf[0] = 0; + + while (buf[0] != '}') { + if (buf[0] == '#') + continue; + + if (!fgets(buf, sizeof(buf), f)) + return; + + p = parse_line(buf); + + if (!strcmp(p->option, "host")) { + g_snprintf(proxyhost, sizeof(proxyhost), "%s", p->value[0]); + } else if (!strcmp(p->option, "port")) { + proxyport = atoi(p->value[0]); + } else if (!strcmp(p->option, "type")) { + proxyport = atoi(p->value[0]); + } else if (!strcmp(p->option, "user")) { + g_snprintf(proxyuser, sizeof(proxyuser), "%s", p->value[0]); + } else if (!strcmp(p->option, "pass")) { + g_snprintf(proxypass, sizeof(proxypass), "%s", p->value[0]); + } + } +} + +static void gaimrc_write_proxy(FILE *f) +{ + fprintf(f, "proxy {\n"); + fprintf(f, "\thost { %s }\n", proxyhost); + fprintf(f, "\tport { %d }\n", proxyport); + fprintf(f, "\ttype { %d }\n", proxytype); + fprintf(f, "\tuser { %s }\n", proxyuser); + fprintf(f, "\tport { %s }\n", proxypass); + fprintf(f, "}\n"); +} + void set_defaults(int saveinfo) { @@ -891,6 +935,9 @@ case 6: gaimrc_read_sounds(f); break; + case 7: + gaimrc_read_proxy(f); + break; default: /* NOOP */ break; @@ -930,6 +977,7 @@ #ifdef GAIM_PLUGINS gaimrc_write_plugins(f); #endif + gaimrc_write_proxy(f); fclose(f); chmod(buf, S_IRUSR | S_IWUSR); }
--- a/src/html.c Tue May 22 23:23:28 2001 +0000 +++ b/src/html.c Wed May 23 07:59:05 2001 +0000 @@ -212,7 +212,7 @@ g_free(gunk); } -void grab_url(struct aim_user *user, char *url, void (*callback)(gpointer, char *), gpointer data) +void grab_url(char *url, void (*callback)(gpointer, char *), gpointer data) { int sock; struct grab_url_data *gunk = g_new0(struct grab_url_data, 1); @@ -222,22 +222,10 @@ gunk->url = g_strdup(url); gunk->website = parse_url(url); - if (user) { - 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); - callback(data, g_strdup(_("g003: Error opening connection.\n"))); - } - } else { - if ((sock = proxy_connect(gunk->website.address, gunk->website.port, NULL, 0, -1, - NULL, NULL, grab_url_callback, gunk)) < 0) { - g_free(gunk->url); - g_free(gunk); - callback(data, g_strdup(_("g003: Error opening connection.\n"))); - } + if ((sock = proxy_connect(gunk->website.address, gunk->website.port, + grab_url_callback, gunk)) < 0) { + g_free(gunk->url); + g_free(gunk); + callback(data, g_strdup(_("g003: Error opening connection.\n"))); } }
--- a/src/oscar.c Tue May 22 23:23:28 2001 +0000 +++ b/src/oscar.c Wed May 23 07:59:05 2001 +0000 @@ -53,11 +53,6 @@ /* constants to identify proto_opts */ #define USEROPT_AUTH 0 #define USEROPT_AUTHPORT 1 -#define USEROPT_PROXYHOST 2 -#define USEROPT_PROXYPORT 3 -#define USEROPT_PROXYTYPE 4 -#define USEROPT_USER 5 -#define USEROPT_PASS 6 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" @@ -473,10 +468,6 @@ user->proto_opt[USEROPT_AUTH] : FAIM_LOGIN_SERVER, user->proto_opt[USEROPT_AUTHPORT][0] ? atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, - 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], oscar_login_connect, gc); if (!user->gc || (conn->fd < 0)) { hide_login_progress(gc, _("Couldn't connect to host")); @@ -668,12 +659,7 @@ } host = g_strndup(bosip, i); bosconn->priv = g_memdup(cookie, AIM_COOKIELEN); - bosconn->fd = proxy_connect(host, port, - gc->user->proto_opt[USEROPT_PROXYHOST], - atoi(gc->user->proto_opt[USEROPT_PROXYPORT]), - atoi(gc->user->proto_opt[USEROPT_PROXYTYPE]), - gc->user->proto_opt[USEROPT_USER], gc->user->proto_opt[USEROPT_PASS], - oscar_bos_connect, gc); + bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc); g_free(host); if (!user->gc || (bosconn->fd < 0)) { if (bosconn->priv) @@ -764,7 +750,6 @@ int gaim_memrequest(struct aim_session_t *sess, struct command_rx_struct *command, ...) { - struct gaim_connection *gc = sess->aux_data; va_list ap; struct pieceofcrap *pos; unsigned long offset, len; @@ -819,12 +804,7 @@ pos->len = len; pos->modname = modname ? g_strdup(modname) : NULL; - fd = proxy_connect("gaim.sourceforge.net", 80, - gc->user->proto_opt[USEROPT_PROXYHOST], - atoi(gc->user->proto_opt[USEROPT_PROXYPORT]), - atoi(gc->user->proto_opt[USEROPT_PROXYTYPE]), - gc->user->proto_opt[USEROPT_USER], gc->user->proto_opt[USEROPT_PASS], - straight_to_hell, pos); + fd = proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos); if (fd < 0) { if (pos->modname) g_free(pos->modname); @@ -1019,7 +999,6 @@ char *ip; unsigned char *cookie; struct gaim_connection *gc = sess->aux_data; - struct aim_user *user = gc->user; struct aim_conn_t *tstconn; int i; char *host; int port = FAIM_LOGIN_PORT, fd; @@ -1053,11 +1032,7 @@ aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, gaim_account_confirm, 0); tstconn->priv = g_memdup(cookie, AIM_COOKIELEN); - fd = proxy_connect(host, port, 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], - oscar_auth_connect, gc); + fd = proxy_connect(host, port, oscar_auth_connect, gc); if (fd < 0) { if (tstconn->priv) g_free(tstconn->priv); @@ -1079,11 +1054,7 @@ aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, gaim_server_ready, 0); tstconn->priv = g_memdup(cookie, AIM_COOKIELEN); - fd = proxy_connect(host, port, 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], - oscar_chatnav_connect, gc); + fd = proxy_connect(host, port, oscar_chatnav_connect, gc); if (fd < 0) { if (tstconn->priv) g_free(tstconn->priv); @@ -1117,11 +1088,7 @@ ccon->show = extract_name(roomname); ccon->priv = g_memdup(cookie, AIM_COOKIELEN); - fd = proxy_connect(host, port, 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], - oscar_chat_connect, ccon); + fd = proxy_connect(host, port, oscar_chat_connect, ccon); if (fd < 0) { aim_conn_kill(sess, &tstconn); debug_printf("unable to connect to chat server\n"); @@ -1278,13 +1245,7 @@ } } host = g_strndup(d->priv->ip, i); - dim->conn->fd = proxy_connect(host, port, - gc->user->proto_opt[USEROPT_PROXYHOST], - atoi(gc->user->proto_opt[USEROPT_PROXYPORT]), - atoi(gc->user->proto_opt[USEROPT_PROXYTYPE]), - gc->user->proto_opt[USEROPT_USER], - gc->user->proto_opt[USEROPT_PASS], - oscar_directim_callback, dim); + dim->conn->fd = proxy_connect(host, port, oscar_directim_callback, dim); g_free(host); if (dim->conn->fd < 0) { aim_conn_kill(od->sess, &dim->conn); @@ -2775,31 +2736,9 @@ } 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_PROXYHOST) { - g_snprintf(user->proto_opt[USEROPT_PROXYHOST], - sizeof(user->proto_opt[USEROPT_PROXYHOST]), "%s", gtk_entry_get_text(entry)); - } 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)); } } -static void oscar_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 oscar_user_opts(GtkWidget *book, struct aim_user *user) { /* so here, we create the new notebook page */ @@ -2807,7 +2746,6 @@ GtkWidget *hbox; GtkWidget *label; GtkWidget *entry; - GtkWidget *first, *opt; vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); @@ -2852,121 +2790,6 @@ 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(oscar_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(oscar_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(oscar_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(oscar_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); - - label = gtk_label_new("Proxy Host:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYHOST); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(oscar_print_option), user); - if (user->proto_opt[USEROPT_PROXYHOST][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYHOST]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYHOST]); - } - gtk_widget_show(entry); - - 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("Proxy Port:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYPORT); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(oscar_print_option), user); - if (user->proto_opt[USEROPT_PROXYPORT][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYPORT]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYPORT]); - } - gtk_widget_show(entry); - - 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("Proxy User:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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(oscar_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); - - 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("Proxy Password:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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(oscar_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 oscar_set_permit_deny(struct gaim_connection *gc) {
--- a/src/prefs.c Tue May 22 23:23:28 2001 +0000 +++ b/src/prefs.c Wed May 23 07:59:05 2001 +0000 @@ -45,6 +45,7 @@ #include "pixmaps/bgcolor.xpm" #include "pixmaps/fgcolor.xpm" #include "pixmaps/save.xpm" +#include "proxy.h" struct debug_window *dw = NULL; static GtkWidget *prefs = NULL; @@ -313,6 +314,170 @@ gtk_widget_show(prefdialog); } +#define PROXYHOST 0 +#define PROXYPORT 1 +#define PROXYTYPE 2 +#define PROXYUSER 3 +#define PROXYPASS 4 + +static void proxy_print_option(GtkEntry *entry, int entrynum) +{ + if (entrynum == PROXYHOST) + g_snprintf(proxyhost, sizeof(proxyhost), "%s", gtk_entry_get_text(entry)); + else if (entrynum == PROXYPORT) + proxyport = atoi(gtk_entry_get_text(entry)); + else if (entrynum == PROXYUSER) + g_snprintf(proxyuser, sizeof(proxyuser), "%s", gtk_entry_get_text(entry)); + else if (entrynum == PROXYPASS) + g_snprintf(proxypass, sizeof(proxypass), "%s", gtk_entry_get_text(entry)); + save_prefs(); +} + +static void proxy_print_optionrad(GtkRadioButton *entry, int entrynum) +{ + proxytype = entrynum; + save_prefs(); +} + +static void proxy_page() +{ + GtkWidget *parent; + GtkWidget *vbox; + GtkWidget *hbox; + GtkWidget *label; + GtkWidget *entry; + GtkWidget *first, *opt; + + parent = prefdialog->parent; + gtk_widget_destroy(prefdialog); + + prefdialog = gtk_frame_new(_("Proxy Options")); + gtk_container_add(GTK_CONTAINER(parent), prefdialog); + + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); + gtk_container_add(GTK_CONTAINER(prefdialog), vbox); + gtk_widget_show(vbox); + + label = gtk_label_new(_("All options take effect immediately unless otherwise noted.")); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); + gtk_widget_show(label); + + label = gtk_label_new(_("Not all protocols can use these proxy options. Please see the " + "README file for details.")); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); + gtk_widget_show(label); + + 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_signal_connect(GTK_OBJECT(first), "clicked", + GTK_SIGNAL_FUNC(proxy_print_optionrad), (void*)PROXY_NONE); + gtk_widget_show(first); + if (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_signal_connect(GTK_OBJECT(opt), "clicked", + GTK_SIGNAL_FUNC(proxy_print_optionrad), (void*)PROXY_SOCKS4); + gtk_widget_show(opt); + if (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_signal_connect(GTK_OBJECT(opt), "clicked", + GTK_SIGNAL_FUNC(proxy_print_optionrad), (void*)PROXY_SOCKS5); + gtk_widget_show(opt); + if (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_signal_connect(GTK_OBJECT(opt), "clicked", + GTK_SIGNAL_FUNC(proxy_print_optionrad), (void*)PROXY_HTTP); + gtk_widget_show(opt); + if (proxytype == PROXY_HTTP) + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); + + hbox = gtk_hbox_new(TRUE, 5); + gtk_box_pack_start(GTK_BOX(vbox), 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); + + entry = gtk_entry_new(); + gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 5); + gtk_signal_connect(GTK_OBJECT(entry), "changed", + GTK_SIGNAL_FUNC(proxy_print_option), (void*)PROXYHOST); + gtk_entry_set_text(GTK_ENTRY(entry), proxyhost); + gtk_widget_show(entry); + + hbox = gtk_hbox_new(TRUE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + 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_start(GTK_BOX(hbox), entry, FALSE, FALSE, 5); + gtk_signal_connect(GTK_OBJECT(entry), "changed", + GTK_SIGNAL_FUNC(proxy_print_option), (void*)PROXYPORT); + if (proxyport) { + char buf[128]; + g_snprintf(buf, sizeof(buf), "%d", proxyport); + gtk_entry_set_text(GTK_ENTRY(entry), buf); + } + 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); + + label = gtk_label_new("Proxy User:"); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); + gtk_widget_show(label); + + entry = gtk_entry_new(); + gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 5); + gtk_signal_connect(GTK_OBJECT(entry), "changed", + GTK_SIGNAL_FUNC(proxy_print_option), (void*)PROXYUSER); + gtk_entry_set_text(GTK_ENTRY(entry), proxyuser); + gtk_widget_show(entry); + + hbox = gtk_hbox_new(TRUE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_widget_show(hbox); + + label = gtk_label_new("Proxy Password:"); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); + gtk_widget_show(label); + + entry = gtk_entry_new(); + gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 5); + gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); + gtk_signal_connect(GTK_OBJECT(entry), "changed", + GTK_SIGNAL_FUNC(proxy_print_option), (void*)PROXYPASS); + gtk_entry_set_text(GTK_ENTRY(entry), proxypass); + gtk_widget_show(entry); + + gtk_widget_show(prefdialog); +} + static void buddy_page() { GtkWidget *parent; @@ -914,7 +1079,7 @@ static void refresh_list(GtkWidget *w, gpointer *m) { - grab_url(NULL, "http://www.aol.com/community/chat/allchats.html", ref_list_callback, NULL); + grab_url("http://www.aol.com/community/chat/allchats.html", ref_list_callback, NULL); } static void add_chat(GtkWidget *w, gpointer *m) @@ -2479,6 +2644,7 @@ void prefs_build_general() { + GtkCTreeNode *node; char *text[1]; text[0] = _("General"); @@ -2486,6 +2652,11 @@ text, 5, NULL, NULL, NULL, NULL, 0, 1); gtk_ctree_node_set_row_data(GTK_CTREE(preftree), general_node, general_page); + text[0] = _("Proxy"); + node = gtk_ctree_insert_node(GTK_CTREE(preftree), general_node, NULL, + text, 5, NULL, NULL, NULL, NULL, 0, 1); + gtk_ctree_node_set_row_data(GTK_CTREE(preftree), node, proxy_page); + gtk_ctree_select(GTK_CTREE(preftree), general_node); }
--- a/src/proxy.c Tue May 22 23:23:28 2001 +0000 +++ b/src/proxy.c Wed May 23 07:59:05 2001 +0000 @@ -40,13 +40,17 @@ #include "gaim.h" #include "proxy.h" +char proxyhost[128] = { 0 }; +int proxyport = 0; +int proxytype = 0; +char proxyuser[128] = { 0 }; +char proxypass[128] = { 0 }; + struct PHB { GdkInputFunction func; gpointer data; char *host; int port; - char *user; - char *pass; gint inpa; }; @@ -157,10 +161,6 @@ 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; @@ -168,10 +168,6 @@ 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; @@ -189,10 +185,6 @@ 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; @@ -203,18 +195,14 @@ 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) { + if (proxyuser) { char *t1, *t2; - t1 = g_strdup_printf("%s:%s", phb->user, phb->pass); + t1 = g_strdup_printf("%s:%s", proxyuser, proxypass); t2 = tobase64(t1); g_free(t1); g_snprintf(cmd, sizeof(cmd), "Proxy-Authorization: Basic %s\r\n", t2); @@ -222,8 +210,6 @@ 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; @@ -234,10 +220,6 @@ 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; @@ -246,10 +228,7 @@ phb->inpa = gdk_input_add(source, GDK_INPUT_READ, http_canread, phb); } -static int proxy_connect_http(char *host, unsigned short port, - char *proxyhost, unsigned short proxyport, - char *user, char *pass, - struct PHB *phb) +static int proxy_connect_http(char *host, unsigned short port, struct PHB *phb) { struct hostent *hp; struct sockaddr_in sin; @@ -274,10 +253,6 @@ 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) { @@ -286,10 +261,6 @@ 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; @@ -300,10 +271,6 @@ 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; @@ -384,9 +351,7 @@ phb->inpa = gdk_input_add(source, GDK_INPUT_READ, s4_canread, phb); } -static int proxy_connect_socks4(char *host, unsigned short port, - char *proxyhost, unsigned short proxyport, - struct PHB *phb) +static int proxy_connect_socks4(char *host, unsigned short port, struct PHB *phb) { struct sockaddr_in sin; struct hostent *hp; @@ -489,10 +454,6 @@ if (write(source, buf, (5 + strlen(phb->host) + 2)) < (5 + strlen(phb->host) + 2)) { 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; @@ -512,10 +473,6 @@ if (read(source, buf, 2) < 2) { 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; @@ -524,10 +481,6 @@ if ((buf[0] != 0x01) || (buf[1] == 0x00)) { 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; @@ -547,10 +500,6 @@ if (read(source, buf, 2) < 2) { 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; @@ -559,27 +508,21 @@ if ((buf[0] != 0x05) || (buf[1] == 0xff)) { 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 (buf[1] == 0x02) { - unsigned int i = strlen(phb->user), j = strlen(phb->pass); + unsigned int i = strlen(proxyuser), j = strlen(proxypass); buf[0] = 0x01; /* version 1 */ buf[1] = i; - memcpy(buf+2, phb->user, i); + memcpy(buf+2, proxyuser, i); buf[2+i] = j; - memcpy(buf+2+i+1, phb->pass, j); + memcpy(buf+2+i+1, proxypass, j); if (write(source, buf, 3+i+j) < 3+i+j) { 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; @@ -604,10 +547,6 @@ 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; @@ -616,7 +555,7 @@ i = 0; buf[0] = 0x05; /* SOCKS version 5 */ - if (phb->user) { + if (proxyuser[0]) { buf[1] = 0x02; /* two methods */ buf[2] = 0x00; /* no authentication */ buf[3] = 0x02; /* username/password authentication */ @@ -631,10 +570,6 @@ debug_printf("unable to write\n"); 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; @@ -643,10 +578,7 @@ phb->inpa = gdk_input_add(source, GDK_INPUT_READ, s5_canread, phb); } -static int proxy_connect_socks5(char *host, unsigned short port, - char *proxyhost, unsigned short proxyport, - char *user, char *pass, - struct PHB *phb) +static int proxy_connect_socks5(char *host, unsigned short port, struct PHB *phb) { int fd = -1; struct sockaddr_in sin; @@ -669,10 +601,6 @@ return -1; } - if (user && pass && user[0] && pass[0]) { - phb->user = g_strdup(user); - phb->pass = g_strdup(pass); - } phb->host = g_strdup(host); phb->port = port; @@ -683,10 +611,6 @@ phb->inpa = gdk_input_add(fd, GDK_INPUT_WRITE, s5_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; @@ -697,10 +621,6 @@ 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; @@ -712,10 +632,7 @@ return fd; } -int proxy_connect(char *host, int port, - char *proxyhost, int proxyport, int proxytype, - char *user, char *pass, - GdkInputFunction func, gpointer data) +int proxy_connect(char *host, int port, GdkInputFunction func, gpointer data) { struct PHB *phb = g_new0(struct PHB, 1); phb->func = func; @@ -731,11 +648,11 @@ !proxyport || (proxyport == -1)) return proxy_connect_none(host, port, phb); else if (proxytype == PROXY_HTTP) - return proxy_connect_http(host, port, proxyhost, proxyport, user, pass, phb); + return proxy_connect_http(host, port, phb); else if (proxytype == PROXY_SOCKS4) - return proxy_connect_socks4(host, port, proxyhost, proxyport, phb); + return proxy_connect_socks4(host, port, phb); else if (proxytype == PROXY_SOCKS5) - return proxy_connect_socks5(host, port, proxyhost, proxyport, user, pass, phb); + return proxy_connect_socks5(host, port, phb); g_free(phb); return -1;
--- a/src/proxy.h Tue May 22 23:23:28 2001 +0000 +++ b/src/proxy.h Wed May 23 07:59:05 2001 +0000 @@ -37,9 +37,12 @@ #define PROXY_SOCKS4 2 #define PROXY_SOCKS5 3 -extern int proxy_connect(char *host, int port, - char *proxyhost, int proxyport, int proxytype, - char *user, char *pass, - GdkInputFunction func, gpointer data); +extern char proxyhost[128]; +extern int proxyport; +extern int proxytype; +extern char proxyuser[128]; +extern char proxypass[128]; + +extern int proxy_connect(char *host, int port, GdkInputFunction func, gpointer data); #endif
--- a/src/toc.c Tue May 22 23:23:28 2001 +0000 +++ b/src/toc.c Wed May 23 07:59:05 2001 +0000 @@ -115,11 +115,6 @@ /* constants to identify proto_opts */ #define USEROPT_AUTH 0 #define USEROPT_AUTHPORT 1 -#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; @@ -150,10 +145,6 @@ 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_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 (!user->gc || (tdt->toc_fd < 0)) { @@ -588,7 +579,7 @@ gc->user->proto_opt[USEROPT_AUTHPORT][0] ? atoi(gc->user->proto_opt[USEROPT_AUTHPORT]) : TOC_PORT, url); - grab_url(gc->user, tmp, toc_got_info, NULL); + grab_url(tmp, toc_got_info, NULL); } else if (!strcasecmp(c, "DIR_STATUS")) { } else if (!strcasecmp(c, "ADMIN_NICK_STATUS")) { } else if (!strcasecmp(c, "ADMIN_PASSWD_STATUS")) { @@ -1023,31 +1014,9 @@ } 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_PROXYHOST) { - g_snprintf(user->proto_opt[USEROPT_PROXYHOST], - sizeof(user->proto_opt[USEROPT_PROXYHOST]), "%s", gtk_entry_get_text(entry)); - } 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)); } } -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 */ @@ -1055,7 +1024,6 @@ GtkWidget *hbox; GtkWidget *label; GtkWidget *entry; - GtkWidget *first, *opt; vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); @@ -1100,121 +1068,6 @@ 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(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); - - label = gtk_label_new("Proxy Host:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYHOST); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); - if (user->proto_opt[USEROPT_PROXYHOST][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYHOST]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYHOST]); - } - gtk_widget_show(entry); - - 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("Proxy Port:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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_PROXYPORT); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); - if (user->proto_opt[USEROPT_PROXYPORT][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PROXYPORT]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PROXYPORT]); - } - gtk_widget_show(entry); - - 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("Proxy User:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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); - - 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("Proxy Password:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - 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) @@ -1643,12 +1496,7 @@ sflap_send(ft->gc, buf, -1, TYPE_DATA); fd = - proxy_connect(ft->ip, ft->port, - 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); + proxy_connect(ft->ip, ft->port, toc_send_file_connect, ft); if (fd < 0) { do_error_dialog(_("Could not connect for transfer!"), _("Error")); g_free(ft->filename); @@ -1868,12 +1716,7 @@ sflap_send(ft->gc, buf2, -1, TYPE_DATA); fd = - proxy_connect(ft->ip, ft->port, - 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); + proxy_connect(ft->ip, ft->port, toc_get_file_connect, ft); if (fd < 0) { do_error_dialog(_("Could not connect for transfer!"), _("Error")); fclose(ft->file);