# HG changeset patch # User Eric Warmenhoven # Date 998517956 0 # Node ID cff133e0ec0c8e40f9589294d4d56145a8cd5249 # Parent 0befa2d2e5406f0ed7587dc5dd30b53e71a6b5aa [gaim-migrate @ 2164] part 2 of this. first was removing mail notifications; this is moving proto_opt stuff to multi.c and just having prpls say what they want. next it's on to the buddy right-click menu. committer: Tailor Script diff -r 0befa2d2e540 -r cff133e0ec0c src/gaim.h --- a/src/gaim.h Wed Aug 22 21:11:58 2001 +0000 +++ b/src/gaim.h Wed Aug 22 22:05:56 2001 +0000 @@ -137,6 +137,7 @@ GtkWidget *rempass; int tmp_options; int tmp_protocol; + GList *opt_entries; /* stuff for password prompt */ GtkWidget *passprmt; diff -r 0befa2d2e540 -r cff133e0ec0c src/multi.c --- a/src/multi.c Wed Aug 22 21:11:58 2001 +0000 +++ b/src/multi.c Wed Aug 22 22:05:56 2001 +0000 @@ -233,6 +233,7 @@ static void ok_mod(GtkWidget *w, struct aim_user *u) { + GList *tmp; const char *txt; int i; @@ -249,6 +250,18 @@ gtk_clist_set_text(GTK_CLIST(list), i, 2, (u->options & OPT_USR_AUTO) ? "True" : "False"); gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(u->protocol)); + + tmp = u->opt_entries; + while (tmp) { + GtkEntry *entry = tmp->data; + int pos = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); + g_snprintf(u->proto_opt[pos], sizeof(u->proto_opt[pos]), "%s", + gtk_entry_get_text(entry)); + tmp = tmp->next; + } + if (u->opt_entries) + g_list_free(tmpusr.opt_entries); + u->opt_entries = NULL; } else { txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.name)); u = new_user(txt, tmpusr.protocol, tmpusr.options); @@ -256,8 +269,17 @@ txt = gtk_entry_get_text(GTK_ENTRY(tmpusr.pass)); g_snprintf(u->password, sizeof(u->password), "%s", txt); - for (i = 0; i < 6; i++) - g_snprintf(u->proto_opt[i], sizeof(u->proto_opt[i]), "%s", tmpusr.proto_opt[i]); + tmp = tmpusr.opt_entries; + while (tmp) { + GtkEntry *entry = tmp->data; + int pos = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); + g_snprintf(u->proto_opt[pos], sizeof(u->proto_opt[pos]), "%s", + gtk_entry_get_text(entry)); + tmp = tmp->next; + } + if (tmpusr.opt_entries) + g_list_free(tmpusr.opt_entries); + tmpusr.opt_entries = NULL; gtk_widget_destroy(newmod); } @@ -267,8 +289,14 @@ static void cancel_mod(GtkWidget *w, struct aim_user *u) { if (u) { + if (u->opt_entries) + g_list_free(u->opt_entries); + u->opt_entries = NULL; gtk_widget_destroy(u->mod); } else { + if (tmpusr.opt_entries) + g_list_free(tmpusr.opt_entries); + tmpusr.opt_entries = NULL; gtk_widget_destroy(newmod); } } @@ -457,10 +485,53 @@ gtk_notebook_remove_page(GTK_NOTEBOOK(book), 1); if (p && p->user_opts) { - if (u) - (*p->user_opts)(book, u); - else - (*p->user_opts)(book, &tmpusr); + GList *op = (*p->user_opts)(); + GList *tmp = op; + + GtkWidget *vbox; + GtkWidget *hbox; + GtkWidget *label; + GtkWidget *entry; + + char buf[256]; + + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); + g_snprintf(buf, sizeof(buf), "%s Options", (*p->name)()); + gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new(buf)); + gtk_widget_show(vbox); + + while (op) { + struct proto_user_opt *puo = op->data; + + 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(puo->label); + 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 *)puo->pos); + if (u->proto_opt[puo->pos][0]) { + debug_printf("setting text %s\n", u->proto_opt[puo->pos]); + gtk_entry_set_text(GTK_ENTRY(entry), u->proto_opt[puo->pos]); + } else { + gtk_entry_set_text(GTK_ENTRY(entry), puo->def); + } + gtk_widget_show(entry); + + if (u) + u->opt_entries = g_list_append(u->opt_entries, entry); + else + tmpusr.opt_entries = g_list_append(tmpusr.opt_entries, entry); + + g_free(puo); + op = op->next; + } + g_list_free(tmp); } } diff -r 0befa2d2e540 -r cff133e0ec0c src/multi.h --- a/src/multi.h Wed Aug 22 21:11:58 2001 +0000 +++ b/src/multi.h Wed Aug 22 22:05:56 2001 +0000 @@ -79,6 +79,12 @@ GtkWidget *email_label; }; +struct proto_user_opt { + char *label; + char *def; + int pos; +}; + /* now that we have our struct, we're going to need lots of them. Maybe even a list of them. */ extern GSList *connections; diff -r 0befa2d2e540 -r cff133e0ec0c src/protocols/icq/gaim_icq.c --- a/src/protocols/icq/gaim_icq.c Wed Aug 22 21:11:58 2001 +0000 +++ b/src/protocols/icq/gaim_icq.c Wed Aug 22 22:05:56 2001 +0000 @@ -445,51 +445,17 @@ gtk_widget_show(button); } -static void icq_print_option(GtkEntry *entry, struct aim_user *user) { - int entrynum; - - entrynum = (int) gtk_object_get_user_data(GTK_OBJECT(entry)); - - if (entrynum == USEROPT_NICK) - g_snprintf(user->proto_opt[USEROPT_NICK], - sizeof(user->proto_opt[USEROPT_NICK]), - "%s", gtk_entry_get_text(entry)); -} - -static void icq_user_opts(GtkWidget *book, struct aim_user *user) { - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *label; - GtkWidget *entry; - - 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("ICQ Options")); - gtk_widget_show(vbox); +static GList *icq_user_opts() { + GList *m = NULL; + struct proto_user_opt *puo; - 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("Nick"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); + puo = g_new0(struct proto_user_opt, 1); + puo->label = "Nick:"; + puo->def = "Gaim User"; + puo->pos = USEROPT_NICK; + m = g_list_append(m, puo); - 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_NICK); - gtk_signal_connect(GTK_OBJECT(entry), "changed", - GTK_SIGNAL_FUNC(icq_print_option), user); - if (user->proto_opt[USEROPT_NICK][0]) - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_NICK]); - else - gtk_entry_set_text(GTK_ENTRY(entry), "gaim 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); + return m; } static GList *icq_away_states() { diff -r 0befa2d2e540 -r cff133e0ec0c src/protocols/irc/irc.c --- a/src/protocols/irc/irc.c Wed Aug 22 21:11:58 2001 +0000 +++ b/src/protocols/irc/irc.c Wed Aug 22 22:05:56 2001 +0000 @@ -1951,71 +1951,24 @@ } } -static void irc_print_option(GtkEntry *entry, struct aim_user *user) -{ - int entrynum; - - entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); - - if (entrynum == USEROPT_SERV) { - g_snprintf(user->proto_opt[USEROPT_SERV], - sizeof(user->proto_opt[USEROPT_SERV]), "%s", gtk_entry_get_text(entry)); - } else if (entrynum == USEROPT_PORT) { - g_snprintf(user->proto_opt[USEROPT_PORT], - sizeof(user->proto_opt[USEROPT_PORT]), "%s", gtk_entry_get_text(entry)); - } -} - -static void irc_user_opts(GtkWidget *book, struct aim_user *user) +static GList *irc_user_opts() { - /* so here, we create the new notebook page */ - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *label; - GtkWidget *entry; - - 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("IRC Options")); - gtk_widget_show(vbox); - - 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("Server:"); - 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_SERV); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); - if (user->proto_opt[USEROPT_SERV][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_SERV]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_SERV]); - } - 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("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_PORT); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(irc_print_option), user); - if (user->proto_opt[USEROPT_PORT][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PORT]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PORT]); - } else - gtk_entry_set_text(GTK_ENTRY(entry), "6667"); - - gtk_widget_show(entry); + GList *m = NULL; + struct proto_user_opt *puo; + + puo = g_new0(struct proto_user_opt, 1); + puo->label = "Server:"; + puo->def = "irc.mozilla.org"; + puo->pos = USEROPT_SERV; + m = g_list_append(m, puo); + + puo = g_new0(struct proto_user_opt, 1); + puo->label = "Port:"; + puo->def = "6667"; + puo->pos = USEROPT_PORT; + m = g_list_append(m, puo); + + return m; } static char **irc_list_icon(int uc) diff -r 0befa2d2e540 -r cff133e0ec0c src/protocols/jabber/jabber.c --- a/src/protocols/jabber/jabber.c Wed Aug 22 21:11:58 2001 +0000 +++ b/src/protocols/jabber/jabber.c Wed Aug 22 22:05:56 2001 +0000 @@ -1957,54 +1957,18 @@ gjab_send_raw(jd->jc, " \t "); } -static void jabber_print_option(GtkEntry *entry, struct aim_user *user) +static GList *jabber_user_opts() { - int entrynum; - - entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); - - if (entrynum == USEROPT_PORT) { - g_snprintf(user->proto_opt[USEROPT_PORT], - sizeof(user->proto_opt[USEROPT_PORT]), "%s", gtk_entry_get_text(entry)); - } -} - -static void jabber_user_opts(GtkWidget *book, struct aim_user *user) -{ - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *label; - GtkWidget *entry; - - 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); + GList *m = NULL; + struct proto_user_opt *puo; - 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("Port:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); + puo = g_new0(struct proto_user_opt, 1); + puo->label = "Port:"; + puo->def = "5222"; + puo->pos = USEROPT_PORT; + m = g_list_append(m, puo); - entry = gtk_entry_new(); - gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); - gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_PORT); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(jabber_print_option), user); - if (isdigit(user->proto_opt[USEROPT_PORT][0])) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PORT]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PORT]); - } else - gtk_entry_set_text(GTK_ENTRY(entry), "5222"); - - label = gtk_label_new("To set the server, make your username be user@server.org."); - gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - gtk_widget_show(entry); + return m; } static struct prpl *my_protocol = NULL; diff -r 0befa2d2e540 -r cff133e0ec0c src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Wed Aug 22 21:11:58 2001 +0000 +++ b/src/protocols/oscar/oscar.c Wed Aug 22 22:05:56 2001 +0000 @@ -2969,74 +2969,24 @@ g_free(n); } - -/* weeee */ -static void oscar_print_option(GtkEntry *entry, struct aim_user *user) -{ - int entrynum; - - entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); - - if (entrynum == USEROPT_AUTH) { - g_snprintf(user->proto_opt[USEROPT_AUTH], - sizeof(user->proto_opt[USEROPT_AUTH]), "%s", gtk_entry_get_text(entry)); - } else if (entrynum == USEROPT_AUTHPORT) { - g_snprintf(user->proto_opt[USEROPT_AUTHPORT], - sizeof(user->proto_opt[USEROPT_AUTHPORT]), "%s", gtk_entry_get_text(entry)); - } -} - -static void oscar_user_opts(GtkWidget *book, struct aim_user *user) +static GList *oscar_user_opts() { - /* so here, we create the new notebook page */ - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *label; - GtkWidget *entry; - - 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("Oscar Options")); - gtk_widget_show(vbox); - - 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("Auth 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_AUTH); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(oscar_print_option), user); - if (user->proto_opt[USEROPT_AUTH][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTH]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTH]); - } else - gtk_entry_set_text(GTK_ENTRY(entry), "login.oscar.aol.com"); - 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("Auth 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_AUTHPORT); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(oscar_print_option), user); - if (user->proto_opt[USEROPT_AUTHPORT][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTHPORT]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTHPORT]); - } else - gtk_entry_set_text(GTK_ENTRY(entry), "5190"); - - gtk_widget_show(entry); + GList *m = NULL; + struct proto_user_opt *puo; + + puo = g_new0(struct proto_user_opt, 1); + puo->label = "Auth Host:"; + puo->def = "login.oscar.aol.com"; + puo->pos = USEROPT_AUTH; + m = g_list_append(m, puo); + + puo = g_new0(struct proto_user_opt, 1); + puo->label = "Auth Port:"; + puo->def = "5190"; + puo->pos = USEROPT_AUTHPORT; + m = g_list_append(m, puo); + + return m; } static void oscar_set_permit_deny(struct gaim_connection *gc) { diff -r 0befa2d2e540 -r cff133e0ec0c src/protocols/toc/toc.c --- a/src/protocols/toc/toc.c Wed Aug 22 21:11:58 2001 +0000 +++ b/src/protocols/toc/toc.c Wed Aug 22 22:05:56 2001 +0000 @@ -1043,72 +1043,24 @@ gtk_widget_show(button); } -static void toc_print_option(GtkEntry *entry, struct aim_user *user) +static GList *toc_user_opts() { - int entrynum; - - entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); - - if (entrynum == USEROPT_AUTH) { - g_snprintf(user->proto_opt[USEROPT_AUTH], - sizeof(user->proto_opt[USEROPT_AUTH]), "%s", gtk_entry_get_text(entry)); - } else if (entrynum == USEROPT_AUTHPORT) { - g_snprintf(user->proto_opt[USEROPT_AUTHPORT], - sizeof(user->proto_opt[USEROPT_AUTHPORT]), "%s", gtk_entry_get_text(entry)); - } -} - -static void toc_user_opts(GtkWidget *book, struct aim_user *user) -{ - /* so here, we create the new notebook page */ - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *label; - GtkWidget *entry; - - 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("TOC Options")); - gtk_widget_show(vbox); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - gtk_widget_show(hbox); + GList *m = NULL; + struct proto_user_opt *puo; - label = gtk_label_new("TOC 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_AUTH); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); - if (user->proto_opt[USEROPT_AUTH][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTH]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTH]); - } else - gtk_entry_set_text(GTK_ENTRY(entry), "toc.oscar.aol.com"); - gtk_widget_show(entry); + puo = g_new0(struct proto_user_opt, 1); + puo->label = "TOC Host:"; + puo->def = "toc.oscar.aol.com"; + puo->pos = USEROPT_AUTH; + m = g_list_append(m, puo); - 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("TOC Port:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); + puo = g_new0(struct proto_user_opt, 1); + puo->label = "TOC Port:"; + puo->def = "9898"; + puo->pos = USEROPT_AUTHPORT; + m = g_list_append(m, puo); - 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_AUTHPORT); - gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); - if (user->proto_opt[USEROPT_AUTHPORT][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTHPORT]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTHPORT]); - } else - gtk_entry_set_text(GTK_ENTRY(entry), "9898"); - - gtk_widget_show(entry); + return m; } static void toc_add_permit(struct gaim_connection *gc, char *who) diff -r 0befa2d2e540 -r cff133e0ec0c src/protocols/yahoo/login.c --- a/src/protocols/yahoo/login.c Wed Aug 22 21:11:58 2001 +0000 +++ b/src/protocols/yahoo/login.c Wed Aug 22 22:05:56 2001 +0000 @@ -20,6 +20,7 @@ */ #include "internal.h" +#include int yahoo_send_login(struct yahoo_session *session, const char *name, const char *password) { diff -r 0befa2d2e540 -r cff133e0ec0c src/protocols/yahoo/misc.c --- a/src/protocols/yahoo/misc.c Wed Aug 22 21:11:58 2001 +0000 +++ b/src/protocols/yahoo/misc.c Wed Aug 22 22:05:56 2001 +0000 @@ -21,6 +21,7 @@ #include "internal.h" #include +#include char *yahoo_urlencode(const char *str) { diff -r 0befa2d2e540 -r cff133e0ec0c src/protocols/yahoo/yay.c --- a/src/protocols/yahoo/yay.c Wed Aug 22 21:11:58 2001 +0000 +++ b/src/protocols/yahoo/yay.c Wed Aug 22 22:05:56 2001 +0000 @@ -47,8 +47,6 @@ #include "pixmaps/status-here.xpm" #include "pixmaps/status-idle.xpm" -#include "pixmaps/cancel.xpm" - #define USEROPT_MAIL 0 #define USEROPT_AUTHHOST 1 @@ -657,129 +655,36 @@ 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_AUTHHOST) { - g_snprintf(user->proto_opt[USEROPT_AUTHHOST], - sizeof(user->proto_opt[USEROPT_AUTHHOST]), - "%s", gtk_entry_get_text(entry)); - } else if (entrynum == USEROPT_AUTHPORT) { - g_snprintf(user->proto_opt[USEROPT_AUTHPORT], - sizeof(user->proto_opt[USEROPT_AUTHPORT]), - "%s", gtk_entry_get_text(entry)); - } else if (entrynum == USEROPT_PAGERHOST) { - g_snprintf(user->proto_opt[USEROPT_PAGERHOST], - sizeof(user->proto_opt[USEROPT_PAGERHOST]), - "%s", gtk_entry_get_text(entry)); - } else if (entrynum == USEROPT_PAGERPORT) { - g_snprintf(user->proto_opt[USEROPT_PAGERPORT], - sizeof(user->proto_opt[USEROPT_PAGERPORT]), - "%s", gtk_entry_get_text(entry)); - } -} - -static void yahoo_user_opts(GtkWidget *book, struct aim_user *user) +static GList *yahoo_user_opts() { - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *label; - GtkWidget *entry; - - 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(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - gtk_widget_show(hbox); + GList *m = NULL; + struct proto_user_opt *puo; - label = gtk_label_new("Yahoo Auth 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_AUTHHOST); - gtk_signal_connect(GTK_OBJECT(entry), "changed", - GTK_SIGNAL_FUNC(yahoo_print_option), user); - if (user->proto_opt[USEROPT_AUTHHOST][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTHHOST]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTHHOST]); - } else { - gtk_entry_set_text(GTK_ENTRY(entry), YAHOO_AUTH_HOST); - } - 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); + puo = g_new0(struct proto_user_opt, 1); + puo->label = "Auth Host:"; + puo->def = YAHOO_AUTH_HOST; + puo->pos = USEROPT_AUTHHOST; + m = g_list_append(m, puo); - label = gtk_label_new("Yahoo Auth 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_AUTHPORT); - gtk_signal_connect(GTK_OBJECT(entry), "changed", - GTK_SIGNAL_FUNC(yahoo_print_option), user); - if (user->proto_opt[USEROPT_AUTHPORT][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTHPORT]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTHPORT]); - } else { - g_snprintf(user->proto_opt[USEROPT_AUTHPORT], sizeof(user->proto_opt[USEROPT_AUTHPORT]), - "%d", YAHOO_AUTH_PORT); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTHPORT]); - } - 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("Yahoo Pager Host:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); + puo = g_new0(struct proto_user_opt, 1); + puo->label = "Auth Port:"; + puo->def = "80"; + puo->pos = USEROPT_AUTHPORT; + m = g_list_append(m, puo); - 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_PAGERHOST); - gtk_signal_connect(GTK_OBJECT(entry), "changed", - GTK_SIGNAL_FUNC(yahoo_print_option), user); - if (user->proto_opt[USEROPT_PAGERHOST][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PAGERHOST]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PAGERHOST]); - } else { - gtk_entry_set_text(GTK_ENTRY(entry), YAHOO_PAGER_HOST); - } - 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); + puo = g_new0(struct proto_user_opt, 1); + puo->label = "Pager Host:"; + puo->def = YAHOO_PAGER_HOST; + puo->pos = USEROPT_PAGERHOST; + m = g_list_append(m, puo); - label = gtk_label_new("Yahoo Pager Port:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); + puo = g_new0(struct proto_user_opt, 1); + puo->label = "Pager Port:"; + puo->def = "5050"; + puo->pos = USEROPT_PAGERHOST; + m = g_list_append(m, puo); - 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_PAGERPORT); - gtk_signal_connect(GTK_OBJECT(entry), "changed", - GTK_SIGNAL_FUNC(yahoo_print_option), user); - if (user->proto_opt[USEROPT_PAGERPORT][0]) { - debug_printf("setting text %s\n", user->proto_opt[USEROPT_PAGERPORT]); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PAGERPORT]); - } else { - g_snprintf(user->proto_opt[USEROPT_PAGERPORT], sizeof(user->proto_opt[USEROPT_PAGERPORT]), - "%d", YAHOO_PAGER_PORT); - gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_PAGERPORT]); - } - gtk_widget_show(entry); + return m; } static void toggle_offline(GtkToggleButton *button, struct conversation *c) diff -r 0befa2d2e540 -r cff133e0ec0c src/prpl.h --- a/src/prpl.h Wed Aug 22 21:11:58 2001 +0000 +++ b/src/prpl.h Wed Aug 22 22:05:56 2001 +0000 @@ -71,6 +71,8 @@ GList *(* away_states)(); GList *(* actions)(); void (* do_action)(struct gaim_connection *, char *); + /* user_opts returns a GList* of g_malloc'd struct proto_user_opts */ + GList *(* user_opts)(); /* when UI plugins come, these will have to be reconciled by returning * structs indicating what kinds of information they want displayed. */ @@ -79,7 +81,6 @@ * then have a prpl-base and prpl-UI stuff. people don't need to change * their UIs all that often anyway. */ void (* buddy_menu)(GtkWidget *, struct gaim_connection *, char *); - void (* user_opts)(GtkWidget *, struct aim_user *); void (* draw_new_user)(GtkWidget *); void (* do_new_user)(); void (* draw_join_chat)(struct gaim_connection *, GtkWidget *);