Mercurial > pidgin.yaz
diff plugins/napster.c @ 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 | 08ac51210d09 |
children | 22a3b4b52971 |
line wrap: on
line diff
--- 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;