Mercurial > pidgin
changeset 1250:b5783215b245
[gaim-migrate @ 1260]
decklin's clean up of the account editor, much needed.
indent -kr -i8 -l105 -ncs -cp7 -npcs -T GtkWidget -T gpointer -T AppletCallbackFunc -T GtkFunction -T gaim_plugin_remove -T name -T FILE -T gchar -T user_opts -T GdkEvent -T GtkObject ...
did about.c, aim.c, away.c, browser.c, buddy_chat.c, gaimrc.c, html.c, idle.c, multi.c. Need to do buddy.c, conversation.c, dialogs.c, oscar.c, perl.c, plugins.c, prefs.c, proxy.c, prpl.c, rvous.c, server.c, sound.c, toc.c, util.c. not doing gtkhtml.c because it's a piece of crap anyway, or *ticker.c because they're syd's.
got rid of debug_buff, just debug_printf now.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 13 Dec 2000 20:18:35 +0000 |
parents | 3e44de27622d |
children | 2d12541cedb1 |
files | src/about.c src/aim.c src/away.c src/browser.c src/buddy.c src/buddy_chat.c src/conversation.c src/dialogs.c src/gaim.h src/gaimrc.c src/gtkhtml.c src/html.c src/idle.c src/multi.c src/oscar.c src/perl.c src/plugins.c src/prefs.c src/rvous.c src/server.c src/toc.c src/util.c |
diffstat | 22 files changed, 1348 insertions(+), 1572 deletions(-) [+] |
line wrap: on
line diff
--- a/src/about.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/about.c Wed Dec 13 20:18:35 2000 +0000 @@ -33,7 +33,7 @@ #include "pixmaps/cancel.xpm" #include "pixmaps/about_small.xpm" -static GtkWidget *about=NULL; +static GtkWidget *about = NULL; static void destroy_about() { @@ -69,57 +69,59 @@ GtkWidget *button; char abouttitle[45]; - + if (!about) { - + about = gtk_window_new(GTK_WINDOW_DIALOG); g_snprintf(abouttitle, sizeof(abouttitle), _("About GAIM v%s"), VERSION); gtk_window_set_title(GTK_WINDOW(about), abouttitle); - gtk_window_set_wmclass(GTK_WINDOW(about), "about", "Gaim" ); + gtk_window_set_wmclass(GTK_WINDOW(about), "about", "Gaim"); gtk_window_set_policy(GTK_WINDOW(about), FALSE, TRUE, TRUE); gtk_widget_realize(about); - aol_icon(about->window); + aol_icon(about->window); vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(about), vbox); frame = gtk_frame_new("Gaim " VERSION); - gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); - fbox = gtk_hbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); + fbox = gtk_hbox_new(FALSE, 5); + gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); gtk_container_add(GTK_CONTAINER(frame), fbox); /* Left side, TOP */ style = gtk_widget_get_style(about); - pm = gdk_pixmap_create_from_xpm_d(about->window, &bm, - &style->bg[GTK_STATE_NORMAL], (gchar **)aol_logo); + pm = gdk_pixmap_create_from_xpm_d(about->window, &bm, + &style->bg[GTK_STATE_NORMAL], (gchar **) aol_logo); pixmap = gtk_pixmap_new(pm, bm); gdk_pixmap_unref(pm); gdk_bitmap_unref(bm); - gtk_box_pack_start(GTK_BOX(fbox), pixmap, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(fbox), pixmap, FALSE, FALSE, 0); /* Set up the author table */ a_table = gtk_table_new(6, 2, TRUE); - gtk_table_set_row_spacings(GTK_TABLE(a_table), 5); - gtk_table_set_col_spacings(GTK_TABLE(a_table), 5); - - label = gtk_label_new(_("GAIM is a client that supports AOL's Instant Messenger protocol. " - "It is written using Gtk+ and is licensed under the GPL.\n" - "URL: http://www.marko.net/gaim/")); + gtk_table_set_row_spacings(GTK_TABLE(a_table), 5); + gtk_table_set_col_spacings(GTK_TABLE(a_table), 5); + + label = + gtk_label_new(_ + ("GAIM is a client that supports AOL's Instant Messenger protocol. " + "It is written using Gtk+ and is licensed under the GPL.\n" + "URL: http://www.marko.net/gaim/")); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); - gtk_table_attach_defaults(GTK_TABLE(a_table), label, 0, 2, 0, 2); + gtk_table_attach_defaults(GTK_TABLE(a_table), label, 0, 2, 0, 2); /* Rob */ label = gtk_label_new("Rob Flynn (Maintainer)"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(a_table), label, 0, 1, 2, 3); - + label = gtk_label_new("rob@tgflinux.com"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(a_table), label, 1, 2, 2, 3); @@ -128,25 +130,25 @@ label = gtk_label_new("Eric Warmenhoven"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(a_table), label, 0, 1, 3, 4); - + label = gtk_label_new("warmenhoven@yahoo.com"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(a_table), label, 1, 2, 3, 4); - + /* Jim */ label = gtk_label_new("Jim Duchek"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(a_table), label, 0, 1, 4, 5); - + /* Mark */ label = gtk_label_new("Mark Spencer"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(a_table), label, 0, 1, 5, 6); - + label = gtk_label_new("markster@marko.net"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_table_attach_defaults(GTK_TABLE(a_table), label, 1, 2, 5, 6); - + gtk_box_pack_start(GTK_BOX(fbox), a_table, TRUE, TRUE, 0); /* Close Button */ @@ -158,9 +160,9 @@ gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); if (null != (void *)2) { - /* 2 can be as sad as 1, it's the loneliest number since the number 1 */ + /* 2 can be as sad as 1, it's the loneliest number since the number 1 */ gtk_signal_connect_object(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(destroy_about), GTK_OBJECT(about)); + GTK_SIGNAL_FUNC(destroy_about), GTK_OBJECT(about)); gtk_signal_connect(GTK_OBJECT(about), "destroy", GTK_SIGNAL_FUNC(destroy_about), GTK_OBJECT(about)); } else { @@ -170,14 +172,13 @@ GTK_SIGNAL_FUNC(version_exit), NULL); } - /* this makes the sizes not work. */ + /* this makes the sizes not work. */ //GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); //gtk_widget_grab_default(button); button = picture_button(about, _("Web Site"), about_small_xpm); gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(about_click), NULL); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(about_click), NULL); if (display_options & OPT_DISP_COOL_LOOK) gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); @@ -185,6 +186,5 @@ /* Let's give'em something to talk about -- woah woah woah */ gtk_widget_show_all(about); - + } -
--- a/src/aim.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/aim.c Wed Dec 13 20:18:35 2000 +0000 @@ -71,7 +71,7 @@ GtkWidget *mainwindow = NULL; -void BuddyTickerCreateWindow( void ); +void BuddyTickerCreateWindow(void); void cancel_logon(void) { @@ -93,7 +93,7 @@ while (c) { p = (struct gaim_plugin *)c->data; if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove)) - (*gaim_plugin_remove)(); + (*gaim_plugin_remove)(); /* we don't need to worry about removing callbacks since * there won't be any more chance to call them back :) */ g_free(p); @@ -110,7 +110,8 @@ static int snd_tmout; int logins_not_muted = 1; -static void sound_timeout() { +static void sound_timeout() +{ logins_not_muted = 1; gtk_timeout_remove(snd_tmout); } @@ -118,21 +119,16 @@ /* we need to do this for Oscar because serv_login only starts the login * process, it doesn't end there. gaim_setup will be called later from * oscar.c, after the buddy list is made and serv_finish_login is called */ -void gaim_setup(struct gaim_connection *gc) { - if (sound_options & OPT_SOUND_LOGIN && - sound_options & OPT_SOUND_SILENT_SIGNON) { +void gaim_setup(struct gaim_connection *gc) +{ + if ((sound_options & OPT_SOUND_LOGIN) && (sound_options & OPT_SOUND_SILENT_SIGNON)) { logins_not_muted = 0; - snd_tmout = gtk_timeout_add(10000, (GtkFunction)sound_timeout, - NULL); + snd_tmout = gtk_timeout_add(10000, (GtkFunction)sound_timeout, NULL); } - #ifdef USE_APPLET set_user_state(online); applet_widget_register_callback(APPLET_WIDGET(applet), - "signoff", - _("Signoff"), - (AppletCallbackFunc)signoff_all, - NULL); + "signoff", _("Signoff"), (AppletCallbackFunc)signoff_all, NULL); #endif /* USE_APPLET */ } @@ -238,37 +234,35 @@ GtkStyle *style; GdkBitmap *mask; - if (mainwindow) { - gtk_widget_show(mainwindow); - return; - } - + if (mainwindow) { + gtk_widget_show(mainwindow); + return; + } + mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); - /* Set the WM name and class */ - gtk_window_set_wmclass(GTK_WINDOW(mainwindow), "login", - "Gaim"); - /* Disallow resizing */ - gtk_window_set_policy(GTK_WINDOW(mainwindow), FALSE, FALSE, TRUE); + /* Set the WM name and class */ + gtk_window_set_wmclass(GTK_WINDOW(mainwindow), "login", "Gaim"); + /* Disallow resizing */ + gtk_window_set_policy(GTK_WINDOW(mainwindow), FALSE, FALSE, TRUE); gtk_widget_realize(mainwindow); - signon = gtk_button_new_with_label(_("Signon")); + signon = gtk_button_new_with_label(_("Signon")); #ifndef NO_MULTI - accts = gtk_button_new_with_label(_("Accounts")); + accts = gtk_button_new_with_label(_("Accounts")); #endif - cancel = gtk_button_new_with_label(_("Cancel")); - reg = gtk_button_new_with_label(_("Register")); - options = gtk_button_new_with_label(_("Options")); + cancel = gtk_button_new_with_label(_("Cancel")); + reg = gtk_button_new_with_label(_("Register")); + options = gtk_button_new_with_label(_("Options")); #ifdef GAIM_PLUGINS - plugs = gtk_button_new_with_label(_("Plugins")); + plugs = gtk_button_new_with_label(_("Plugins")); #endif - table = gtk_table_new(8, 2, FALSE); - name = gtk_combo_new(); - pass = gtk_entry_new(); + table = gtk_table_new(8, 2, FALSE); + name = gtk_combo_new(); + pass = gtk_entry_new(); gtk_combo_set_popdown_strings(GTK_COMBO(name), combo_user_names()); - if (display_options & OPT_DISP_COOL_LOOK) - { + if (display_options & OPT_DISP_COOL_LOOK) { gtk_button_set_relief(GTK_BUTTON(signon), GTK_RELIEF_NONE); #ifndef NO_MULTI gtk_button_set_relief(GTK_BUTTON(accts), GTK_RELIEF_NONE); @@ -283,26 +277,22 @@ /* Make the buttons do stuff */ /* Clicking the button initiates a login */ - gtk_signal_connect(GTK_OBJECT(signon), "clicked", - GTK_SIGNAL_FUNC(dologin), mainwindow); + gtk_signal_connect(GTK_OBJECT(signon), "clicked", GTK_SIGNAL_FUNC(dologin), mainwindow); #ifndef NO_MULTI - gtk_signal_connect(GTK_OBJECT(accts), "clicked", - GTK_SIGNAL_FUNC(account_editor), mainwindow); + gtk_signal_connect(GTK_OBJECT(accts), "clicked", GTK_SIGNAL_FUNC(account_editor), mainwindow); #endif - gtk_signal_connect(GTK_OBJECT(cancel), "clicked", - GTK_SIGNAL_FUNC(cancel_logon), mainwindow); + gtk_signal_connect(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(cancel_logon), mainwindow); /* Allow user to change prefs before logging in */ - gtk_signal_connect(GTK_OBJECT(options), "clicked", - GTK_SIGNAL_FUNC(show_prefs), NULL); + gtk_signal_connect(GTK_OBJECT(options), "clicked", GTK_SIGNAL_FUNC(show_prefs), NULL); #ifdef GAIM_PLUGINS /* Allow user to control plugins before logging in */ - gtk_signal_connect(GTK_OBJECT(plugs), "clicked", - GTK_SIGNAL_FUNC(show_plugins), NULL); + gtk_signal_connect(GTK_OBJECT(plugs), "clicked", GTK_SIGNAL_FUNC(show_plugins), NULL); #endif /* Register opens the right URL */ gtk_signal_connect(GTK_OBJECT(reg), "clicked", - GTK_SIGNAL_FUNC(open_url), "http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no"); + GTK_SIGNAL_FUNC(open_url), + "http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no"); /* Enter in the username clears the password and sets the pointer in the password field */ gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "activate", @@ -310,15 +300,14 @@ gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "changed", GTK_SIGNAL_FUNC(combo_changed), name); - gtk_signal_connect(GTK_OBJECT(pass), "activate", - GTK_SIGNAL_FUNC(doenter), mainwindow); + gtk_signal_connect(GTK_OBJECT(pass), "activate", GTK_SIGNAL_FUNC(doenter), mainwindow); gtk_signal_connect(GTK_OBJECT(mainwindow), "delete_event", GTK_SIGNAL_FUNC(cancel_logon), mainwindow); /* Homogenous spacing, 10 padding */ bbox = gtk_hbox_new(TRUE, 10); hbox = gtk_hbox_new(TRUE, 10); sbox = gtk_vbox_new(TRUE, 5); - + gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); #ifndef NO_MULTI gtk_box_pack_start(GTK_BOX(bbox), accts, TRUE, TRUE, 0); @@ -336,10 +325,10 @@ /* Labels for selectors and text boxes */ label = gtk_label_new(_("Screen Name: ")); - gtk_table_attach(GTK_TABLE(table), label, 0,1,2,3,0,0, 5, 5); + gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, 0, 0, 5, 5); gtk_widget_show(label); label = gtk_label_new(_("Password: ")); - gtk_table_attach(GTK_TABLE(table), label, 0,1,3,4,0,0, 5, 5); + gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, 0, 0, 5, 5); gtk_widget_show(label); gtk_widget_show(options); @@ -348,10 +337,10 @@ #endif /* Adjust sizes of inputs */ - gtk_widget_set_usize(name,100,0); - gtk_widget_set_usize(pass,100,0); + gtk_widget_set_usize(name, 100, 0); + gtk_widget_set_usize(pass, 100, 0); - + /* Attach the buttons at the bottom */ gtk_widget_show(signon); gtk_widget_show(cancel); @@ -362,27 +351,26 @@ gtk_widget_show(bbox); gtk_widget_show(hbox); gtk_widget_show(sbox); - gtk_table_attach(GTK_TABLE(table), sbox, 0,2,7,8,0,0, 5, 5); - + gtk_table_attach(GTK_TABLE(table), sbox, 0, 2, 7, 8, 0, 0, 5, 5); + /* Text fields */ - - gtk_table_attach(GTK_TABLE(table),name,1,2,2,3,0,0,5,5); + + gtk_table_attach(GTK_TABLE(table), name, 1, 2, 2, 3, 0, 0, 5, 5); gtk_widget_show(name); - gtk_table_attach(GTK_TABLE(table),pass,1,2,3,4,0,0,5,5); + gtk_table_attach(GTK_TABLE(table), pass, 1, 2, 3, 4, 0, 0, 5, 5); gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); gtk_widget_show(pass); - - gtk_container_border_width(GTK_CONTAINER(sbox), 10); - - gtk_container_add(GTK_CONTAINER(mainwindow),table ); - + + gtk_container_border_width(GTK_CONTAINER(sbox), 10); + + gtk_container_add(GTK_CONTAINER(mainwindow), table); + gtk_widget_show(table); - gtk_window_set_title(GTK_WINDOW(mainwindow),_("Gaim - Login")); + gtk_window_set_title(GTK_WINDOW(mainwindow), _("Gaim - Login")); if (aim_users) { struct aim_user *c = (struct aim_user *)aim_users->data; - sprintf(debug_buff, "First user is %s\n", c->username); if (c->options & OPT_USR_REM_PASS) { combo_changed(NULL, name); gtk_widget_grab_focus(signon); @@ -393,29 +381,29 @@ gtk_widget_grab_focus(name); } - gtk_widget_realize(mainwindow); + gtk_widget_realize(mainwindow); /* Logo at the top */ style = gtk_widget_get_style(mainwindow); pm = gdk_pixmap_create_from_xpm_d(mainwindow->window, &mask, - &style->bg[GTK_STATE_NORMAL], (gchar **)aol_logo); - pmw = gtk_pixmap_new( pm, mask); - gtk_table_attach(GTK_TABLE(table), pmw, 0,2,0,1,0,0,5,5); + &style->bg[GTK_STATE_NORMAL], (gchar **) aol_logo); + pmw = gtk_pixmap_new(pm, mask); + gtk_table_attach(GTK_TABLE(table), pmw, 0, 2, 0, 1, 0, 0, 5, 5); gtk_widget_show(pmw); gdk_pixmap_unref(pm); gdk_bitmap_unref(mask); - - aol_icon(mainwindow->window); + + aol_icon(mainwindow->window); #ifndef _WIN32 - gdk_window_set_group(mainwindow->window, mainwindow->window); + gdk_window_set_group(mainwindow->window, mainwindow->window); #endif - - gtk_widget_show(mainwindow); + + gtk_widget_show(mainwindow); SetTickerPrefs(); - + } extern void show_debug(GtkObject *); @@ -424,7 +412,7 @@ void sighandler(int sig) { fprintf(stderr, "God damn, I tripped.\n"); - exit(11); /* signal 11 */ + exit(11); /* signal 11 */ } #endif @@ -432,31 +420,28 @@ int main(int argc, char *argv[]) { char opt; - int opt_acct = 0, opt_help = 0, opt_version = 0, - opt_user = 0, opt_login = 0, do_login_ret = -1; + int opt_acct = 0, opt_help = 0, opt_version = 0, opt_user = 0, opt_login = 0, do_login_ret = -1; char *opt_user_arg = NULL, *opt_login_arg = NULL; #ifdef USE_GNOME int i; poptContext popt_context; - struct poptOption popt_options[] = - { - {"acct", 'a', POPT_ARG_NONE, &opt_acct, 'a', + struct poptOption popt_options[] = { + {"acct", 'a', POPT_ARG_NONE, &opt_acct, 'a', "Display account editor window", NULL}, - {"login", 'l', POPT_ARG_STRING, NULL, 'l', + {"login", 'l', POPT_ARG_STRING, NULL, 'l', "Automatically login (optional argument NAME specifies account(s) to use)", "[NAME]"}, - {"user", 'u', POPT_ARG_STRING, &opt_user_arg, 'u', + {"user", 'u', POPT_ARG_STRING, &opt_user_arg, 'u', "Use account NAME", "NAME"}, {0, 0, 0, 0, 0, 0, 0} }; #else - struct option long_options[] = - { - {"acct", no_argument, NULL, 'a'}, - {"help", no_argument, NULL, 'h'}, - {"login", optional_argument, NULL, 'l'}, - {"user", required_argument, NULL, 'u'}, - {"version", no_argument, NULL, 'v'}, + struct option long_options[] = { + {"acct", no_argument, NULL, 'a'}, + {"help", no_argument, NULL, 'h'}, + {"login", optional_argument, NULL, 'l'}, + {"user", required_argument, NULL, 'u'}, + {"version", no_argument, NULL, 'v'}, {0, 0, 0, 0} }; #endif /* USE_GNOME */ @@ -474,63 +459,62 @@ #ifdef USE_APPLET - init_applet_mgr(argc, argv); + init_applet_mgr(argc, argv); #elif defined USE_GNOME for (i = 0; i < argc; i++) { /* --login option */ - if (strstr (argv[i], "--l") == argv[i]) { + if (strstr(argv[i], "--l") == argv[i]) { char *equals; opt_login = 1; if ((equals = strchr(argv[i], '=')) != NULL) { /* --login=NAME */ - opt_login_arg = g_strdup (equals+1); - } else if (i+1 < argc && argv[i+1][0] != '-') { + opt_login_arg = g_strdup(equals + 1); + } else if (i + 1 < argc && argv[i + 1][0] != '-') { /* --login NAME */ - opt_login_arg = g_strdup (argv[i+1]); - strcpy (argv[i+1], " "); + opt_login_arg = g_strdup(argv[i + 1]); + strcpy(argv[i + 1], " "); } - strcpy (argv[i], " "); + strcpy(argv[i], " "); } /* -l option */ - else if (strstr (argv[i], "-l") == argv[i]) { + else if (strstr(argv[i], "-l") == argv[i]) { opt_login = 1; - if (strlen (argv[i]) > 2) { + if (strlen(argv[i]) > 2) { /* -lNAME */ - opt_login_arg = g_strdup (argv[i]+2); - } else if (i+1 < argc && argv[i+1][0] != '-') { + opt_login_arg = g_strdup(argv[i] + 2); + } else if (i + 1 < argc && argv[i + 1][0] != '-') { /* -l NAME */ - opt_login_arg = g_strdup (argv[i+1]); - strcpy (argv[i+1], " "); + opt_login_arg = g_strdup(argv[i + 1]); + strcpy(argv[i + 1], " "); } - strcpy (argv[i], " "); + strcpy(argv[i], " "); } - } + } - gnome_init_with_popt_table(PACKAGE,VERSION,argc,argv, - popt_options,0,NULL); + gnome_init_with_popt_table(PACKAGE, VERSION, argc, argv, popt_options, 0, NULL); #else - gtk_init(&argc, &argv); + gtk_init(&argc, &argv); /* scan command-line options */ opterr = 1; - while ((opt = getopt_long (argc, argv, /*"ahl::u:v"*/"ahl::u:v", - long_options, NULL)) != -1) { + while ((opt = getopt_long(argc, argv, /*"ahl::u:v" */ "ahl::u:v", + long_options, NULL)) != -1) { switch (opt) { - case 'u': /* set user */ + case 'u': /* set user */ opt_user = 1; - opt_user_arg = g_strdup (optarg); + opt_user_arg = g_strdup(optarg); break; case 'l': opt_login = 1; - opt_login_arg = g_strdup (optarg); + opt_login_arg = g_strdup(optarg); break; - case 'a': /* account editor */ + case 'a': /* account editor */ opt_acct = 1; break; - case 'v': /* version */ + case 'v': /* version */ opt_version = 1; break; - case 'h': /* help */ + case 'h': /* help */ opt_help = 1; break; case '?': @@ -551,7 +535,7 @@ /* show version window */ if (opt_version) { gtk_init(&argc, &argv); - set_defaults(FALSE); /* needed for open_url_nw */ + set_defaults(FALSE); /* needed for open_url_nw */ load_prefs(); show_about(0, (void *)2); gtk_main(); @@ -559,14 +543,14 @@ } - set_defaults(FALSE); - load_prefs(); + set_defaults(FALSE); + load_prefs(); /* set the default username */ if (opt_user_arg != NULL) { - set_first_user (opt_user_arg); + set_first_user(opt_user_arg); #ifndef USE_GNOME - g_free (opt_user_arg); + g_free(opt_user_arg); opt_user_arg = NULL; #endif /* USE_GNOME */ } @@ -583,9 +567,9 @@ /* deal with --login */ if (opt_login) { - do_login_ret = do_auto_login (opt_login_arg); + do_login_ret = do_auto_login(opt_login_arg); if (opt_login_arg != NULL) { - g_free (opt_login_arg); + g_free(opt_login_arg); opt_login_arg = NULL; } } @@ -595,39 +579,31 @@ #ifdef USE_APPLET applet_widget_register_callback(APPLET_WIDGET(applet), - "prefs", - _("Preferences"), - show_prefs, - NULL); - applet_widget_register_callback(APPLET_WIDGET(applet), + "prefs", _("Preferences"), show_prefs, NULL); + applet_widget_register_callback(APPLET_WIDGET(applet), "accounts", - _("Accounts"), - (AppletCallbackFunc)account_editor, - (void *)1); + _("Accounts"), (AppletCallbackFunc)account_editor, (void *)1); #ifdef GAIM_PLUGINS - applet_widget_register_callback(APPLET_WIDGET(applet), - "plugins", - _("Plugins"), - GTK_SIGNAL_FUNC(show_plugins), - NULL); + applet_widget_register_callback(APPLET_WIDGET(applet), + "plugins", _("Plugins"), GTK_SIGNAL_FUNC(show_plugins), NULL); #endif /* GAIM_PLUGINS */ update_pixmaps(); - + applet_widget_gtk_main(); #else if (opt_acct) { - account_editor (NULL, NULL); + account_editor(NULL, NULL); } else if (do_login_ret == -1) show_login(); - gtk_main(); - + gtk_main(); + #endif /* USE_APPLET */ - + gtkspell_stop(); return 0; - + }
--- a/src/away.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/away.c Wed Dec 13 20:18:35 2000 +0000 @@ -36,7 +36,7 @@ #include "gaim.h" #include "pixmaps/join.xpm" -GtkWidget *imaway=NULL; +GtkWidget *imaway = NULL; GtkWidget *awaymenu = NULL; struct away_message *awaymessage = NULL; @@ -47,24 +47,24 @@ { if (imaway) gtk_widget_destroy(imaway); - imaway=NULL; + imaway = NULL; } void do_im_back(GtkWidget *w, GtkWidget *x) { #ifdef USE_APPLET - applet_widget_unregister_callback(APPLET_WIDGET(applet),"away"); + applet_widget_unregister_callback(APPLET_WIDGET(applet), "away"); set_user_state(online); insert_applet_away(); #endif /* USE_APPLET */ if (imaway) { GtkWidget *tmp = imaway; - imaway=NULL; + imaway = NULL; gtk_widget_destroy(tmp); plugin_event(event_back, 0, 0, 0, 0); - } + } - serv_set_away(NULL); + serv_set_away(NULL); awaymessage = NULL; } @@ -73,17 +73,17 @@ * rcg10312000 This could be more robust, but it works for my current * goal: to remove those annoying <BR> tags. :) */ -static void strncpy_nohtml(gchar *dest, const gchar *src, size_t destsize) +static void strncpy_nohtml(gchar * dest, const gchar * src, size_t destsize) { gchar *ptr; g_snprintf(dest, destsize, "%s", src); while (1) { ptr = strstr(dest, "<BR>"); - if (ptr == NULL) /* done? */ + if (ptr == NULL) /* done? */ return; - /* replace <BR> with a newline. */ + /* replace <BR> with a newline. */ *ptr = '\n'; memmove(ptr + 1, ptr + 4, strlen(ptr + 4) + 1); } @@ -92,64 +92,59 @@ void do_away_message(GtkWidget *w, struct away_message *a) { GtkWidget *back; - GtkWidget *awaytext; - GtkWidget *vscrollbar; + GtkWidget *awaytext; + GtkWidget *vscrollbar; GtkWidget *vbox; - char *buf2; - char buf[BUF_LONG]; - GList *cnv = conversations; - struct conversation *c; + char *buf2; + char buf[BUF_LONG]; + GList *cnv = conversations; + struct conversation *c; if (!blist) return; #ifdef USE_APPLET remove_applet_away(); - applet_widget_register_callback(APPLET_WIDGET(applet), - "away", - _("Back"), - (AppletCallbackFunc) do_im_back, - NULL); + applet_widget_register_callback(APPLET_WIDGET(applet), + "away", _("Back"), (AppletCallbackFunc)do_im_back, NULL); set_user_state(away); #endif if (!imaway) { imaway = gtk_window_new(GTK_WINDOW_DIALOG); - gtk_window_set_wmclass(GTK_WINDOW(imaway), "imaway", "Gaim"); + gtk_window_set_wmclass(GTK_WINDOW(imaway), "imaway", "Gaim"); gtk_widget_realize(imaway); aol_icon(imaway->window); back = picture_button(imaway, _("I'm Back!"), join_xpm); - vbox = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); awaytext = gtk_text_new(NULL, NULL); /* rcg10312000 Convert basic HTML (<BR>, etc) to plain text. - g_snprintf(buf, sizeof(buf), "%s", a->message); - */ - strncpy_nohtml(buf, a->message, sizeof (buf)); + g_snprintf(buf, sizeof(buf), "%s", a->message); + */ + strncpy_nohtml(buf, a->message, sizeof(buf)); - vscrollbar = gtk_vscrollbar_new(GTK_TEXT(awaytext)->vadj); + vscrollbar = gtk_vscrollbar_new(GTK_TEXT(awaytext)->vadj); gtk_widget_show(vscrollbar); gtk_widget_set_usize(awaytext, 225, 100); - gtk_text_set_word_wrap(GTK_TEXT(awaytext), TRUE); - gtk_widget_show(awaytext); + gtk_text_set_word_wrap(GTK_TEXT(awaytext), TRUE); + gtk_widget_show(awaytext); gtk_text_freeze(GTK_TEXT(awaytext)); gtk_text_insert(GTK_TEXT(awaytext), NULL, NULL, NULL, buf, -1); gtk_widget_show(awaytext); if (display_options & OPT_DISP_COOL_LOOK) gtk_button_set_relief(GTK_BUTTON(back), GTK_RELIEF_NONE); - + /* Put the buttons in the box */ gtk_box_pack_start(GTK_BOX(vbox), awaytext, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), back, FALSE, FALSE, 0); - + /* Handle closes right */ - gtk_signal_connect(GTK_OBJECT(imaway), "destroy", - GTK_SIGNAL_FUNC(do_im_back), imaway); - gtk_signal_connect(GTK_OBJECT(back), "clicked", - GTK_SIGNAL_FUNC(do_im_back), imaway); + gtk_signal_connect(GTK_OBJECT(imaway), "destroy", GTK_SIGNAL_FUNC(do_im_back), imaway); + gtk_signal_connect(GTK_OBJECT(back), "clicked", GTK_SIGNAL_FUNC(do_im_back), imaway); /* Finish up */ gtk_widget_show(back); @@ -157,29 +152,29 @@ if (strlen(a->name)) gtk_window_set_title(GTK_WINDOW(imaway), a->name); else - gtk_window_set_title(GTK_WINDOW(imaway), _("Gaim - Away!")); + gtk_window_set_title(GTK_WINDOW(imaway), _("Gaim - Away!")); gtk_window_set_focus(GTK_WINDOW(imaway), back); gtk_container_add(GTK_CONTAINER(imaway), vbox); awaymessage = a; - } else { + } else { destroy_im_away(); do_away_message(w, a); return; } - /* New away message... Clear out the old sent_aways */ - while(cnv) { - c = (struct conversation *)cnv->data; - c->sent_away = 0; - cnv = cnv->next; - } + /* New away message... Clear out the old sent_aways */ + while (cnv) { + c = (struct conversation *)cnv->data; + c->sent_away = 0; + cnv = cnv->next; + } - buf2 = g_malloc(strlen(awaymessage->message)*4 + 1); - strncpy_withhtml(buf2, awaymessage->message, strlen(awaymessage->message)*4 + 1); - serv_set_away(buf2); - g_free(buf2); + buf2 = g_malloc(strlen(awaymessage->message) * 4 + 1); + strncpy_withhtml(buf2, awaymessage->message, strlen(awaymessage->message) * 4 + 1); + serv_set_away(buf2); + g_free(buf2); gtk_widget_show(imaway); plugin_event(event_away, 0, 0, 0, 0); } @@ -189,7 +184,7 @@ struct away_message *default_msg; #ifdef USE_APPLET char *awayname; - awayname = g_malloc(sizeof (*awayname) * (6 + strlen(a->name))); + awayname = g_malloc(sizeof(*awayname) * (6 + strlen(a->name))); awayname[0] = '\0'; strcat(awayname, "away/"); strcat(awayname, a->name); @@ -197,13 +192,13 @@ g_free(awayname); #endif default_msg = g_slist_nth_data(away_messages, default_away); - away_messages = g_slist_remove(away_messages, a); + away_messages = g_slist_remove(away_messages, a); default_away = g_slist_index(away_messages, default_msg); if (default_away == -1) default_away = 0; - g_free(a); - do_away_menu(); - save_prefs(); + g_free(a); + do_away_menu(); + save_prefs(); } @@ -216,29 +211,27 @@ GtkWidget *sep; GList *l; GtkWidget *list_item; - GSList *awy = away_messages; - struct away_message *a; + GSList *awy = away_messages; + struct away_message *a; #ifdef USE_APPLET remove_applet_away(); if (imaway) applet_widget_register_callback(APPLET_WIDGET(applet), - "away", - _("Back"), - (AppletCallbackFunc)do_im_back, - NULL); + "away", _("Back"), (AppletCallbackFunc)do_im_back, NULL); else insert_applet_away(); #endif if (prefs_away_list != NULL) { - gtk_list_clear_items(GTK_LIST(prefs_away_list), 0, -1); - while(awy) { + gtk_list_clear_items(GTK_LIST(prefs_away_list), 0, -1); + while (awy) { a = (struct away_message *)awy->data; label = gtk_label_new(a->name); list_item = gtk_list_item_new(); gtk_container_add(GTK_CONTAINER(list_item), label); - gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(away_list_clicked), a); + gtk_signal_connect(GTK_OBJECT(list_item), "select", + GTK_SIGNAL_FUNC(away_list_clicked), a); /* gtk_signal_connect(GTK_OBJECT(list_item), "deselect", GTK_SIGNAL_FUNC(away_list_unclicked), a);*/ gtk_object_set_user_data(GTK_OBJECT(list_item), a); @@ -249,13 +242,13 @@ awy = g_slist_next(awy); } if (away_messages != NULL) - gtk_list_select_item(GTK_LIST(prefs_away_list), 0); + gtk_list_select_item(GTK_LIST(prefs_away_list), 0); } - + if (awaymenu) { l = gtk_container_children(GTK_CONTAINER(awaymenu)); - - while(l) { + + while (l) { gtk_widget_destroy(GTK_WIDGET(l->data)); l = l->next; } @@ -266,27 +259,29 @@ menuitem = gtk_menu_item_new_with_label(_("New Away Message")); gtk_menu_append(GTK_MENU(awaymenu), menuitem); gtk_widget_show(menuitem); - gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(create_away_mess), NULL); - + gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(create_away_mess), + NULL); + awy = away_messages; - while(awy) { + while (awy) { a = (struct away_message *)awy->data; - + remitem = gtk_menu_item_new_with_label(a->name); gtk_menu_append(GTK_MENU(remmenu), remitem); gtk_widget_show(remitem); - gtk_signal_connect(GTK_OBJECT(remitem), "activate", GTK_SIGNAL_FUNC(rem_away_mess), a); - + gtk_signal_connect(GTK_OBJECT(remitem), "activate", + GTK_SIGNAL_FUNC(rem_away_mess), a); + awy = g_slist_next(awy); - + } - + menuitem = gtk_menu_item_new_with_label(_("Remove Away Message")); gtk_menu_append(GTK_MENU(awaymenu), menuitem); gtk_widget_show(menuitem); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), remmenu); gtk_widget_show(remmenu); - + sep = gtk_hseparator_new(); menuitem = gtk_menu_item_new(); gtk_menu_append(GTK_MENU(awaymenu), menuitem); @@ -294,24 +289,25 @@ gtk_widget_set_sensitive(menuitem, FALSE); gtk_widget_show(menuitem); gtk_widget_show(sep); - + awy = away_messages; - - while(awy) { + + while (awy) { a = (struct away_message *)awy->data; - + menuitem = gtk_menu_item_new_with_label(a->name); gtk_menu_append(GTK_MENU(awaymenu), menuitem); gtk_widget_show(menuitem); - gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(do_away_message), a); - + gtk_signal_connect(GTK_OBJECT(menuitem), "activate", + GTK_SIGNAL_FUNC(do_away_message), a); + awy = g_slist_next(awy); - + } } if (prefs_away_menu) { l = gtk_container_children(GTK_CONTAINER(prefs_away_menu)); - while(l) { + while (l) { gtk_widget_destroy(GTK_WIDGET(l->data)); l = l->next; } @@ -321,9 +317,3 @@ } } - - - - - -
--- a/src/browser.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/browser.c Wed Dec 13 20:18:35 2000 +0000 @@ -60,59 +60,56 @@ #define MOZILLA_COMMAND_PROP "_MOZILLA_COMMAND" #define MOZILLA_RESPONSE_PROP "_MOZILLA_RESPONSE" -static GdkAtom XA_MOZILLA_VERSION = 0; -static GdkAtom XA_MOZILLA_LOCK = 0; -static GdkAtom XA_MOZILLA_COMMAND = 0; +static GdkAtom XA_MOZILLA_VERSION = 0; +static GdkAtom XA_MOZILLA_LOCK = 0; +static GdkAtom XA_MOZILLA_COMMAND = 0; static GdkAtom XA_MOZILLA_RESPONSE = 0; static int netscape_lock; -static Window -VirtualRootWindowOfScreen(screen) - Screen *screen; +static Window VirtualRootWindowOfScreen(screen) +Screen *screen; { - static Screen *save_screen = (Screen *)0; - static Window root = (Window)0; + static Screen *save_screen = (Screen *) 0; + static Window root = (Window) 0; - if (screen != save_screen) { - Display *dpy = DisplayOfScreen(screen); - Atom __SWM_VROOT = None; - unsigned int i; - Window rootReturn, parentReturn, *children; - unsigned int numChildren; + if (screen != save_screen) { + Display *dpy = DisplayOfScreen(screen); + Atom __SWM_VROOT = None; + unsigned int i; + Window rootReturn, parentReturn, *children; + unsigned int numChildren; - root = RootWindowOfScreen(screen); + root = RootWindowOfScreen(screen); - /* go look for a virtual root */ - __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False); - if (XQueryTree(dpy, root, &rootReturn, &parentReturn, - &children, &numChildren)) { - for (i = 0; i < numChildren; i++) { - Atom actual_type; - int actual_format; - unsigned long nitems, bytesafter; - Window *newRoot = (Window *)0; + /* go look for a virtual root */ + __SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False); + if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) { + for (i = 0; i < numChildren; i++) { + Atom actual_type; + int actual_format; + unsigned long nitems, bytesafter; + Window *newRoot = (Window *) 0; - if (XGetWindowProperty(dpy, children[i], - __SWM_VROOT, 0, 1, False, XA_WINDOW, - &actual_type, &actual_format, - &nitems, &bytesafter, - (unsigned char **) &newRoot) == Success - && newRoot) { - root = *newRoot; - break; - } - } - if (children) - XFree((char *)children); - } + if (XGetWindowProperty(dpy, children[i], + __SWM_VROOT, 0, 1, False, XA_WINDOW, + &actual_type, &actual_format, + &nitems, &bytesafter, + (unsigned char **)&newRoot) == Success && newRoot) { + root = *newRoot; + break; + } + } + if (children) + XFree((char *)children); + } - save_screen = screen; - } + save_screen = screen; + } - return root; + return root; } /* The following code is Copyright (C) 1989 X Consortium */ @@ -121,68 +118,67 @@ /* Find a window with WM_STATE, else return win itself, as per ICCCM */ -static Window GClientWindow (dpy, win) - Display *dpy; - Window win; +static Window GClientWindow(dpy, win) +Display *dpy; +Window win; { - Atom WM_STATE; - Atom type = None; - int format; - unsigned long nitems, after; - unsigned char *data; - Window inf; + Atom WM_STATE; + Atom type = None; + int format; + unsigned long nitems, after; + unsigned char *data; + Window inf; - WM_STATE = XInternAtom(dpy, "WM_STATE", True); - if (!WM_STATE) - return win; - XGetWindowProperty(dpy, win, WM_STATE, 0, 0, False, AnyPropertyType, - &type, &format, &nitems, &after, &data); - if (type) - { + WM_STATE = XInternAtom(dpy, "WM_STATE", True); + if (!WM_STATE) + return win; + XGetWindowProperty(dpy, win, WM_STATE, 0, 0, False, AnyPropertyType, + &type, &format, &nitems, &after, &data); + if (type) { + XFree(data); + return win; + } + + inf = TryChildren(dpy, win, WM_STATE); + if (!inf) + inf = win; + XFree(data); - return win; - } - inf = TryChildren(dpy, win, WM_STATE); - if (!inf) - inf = win; - - XFree(data); - - return inf; + return inf; } static -Window TryChildren (dpy, win, WM_STATE) - Display *dpy; - Window win; - Atom WM_STATE; +Window TryChildren(dpy, win, WM_STATE) +Display *dpy; +Window win; +Atom WM_STATE; { - Window root, parent; - Window *children; - unsigned int nchildren; - unsigned int i; - Atom type = None; - int format; - unsigned long nitems, after; - unsigned char *data; - Window inf = 0; + Window root, parent; + Window *children; + unsigned int nchildren; + unsigned int i; + Atom type = None; + int format; + unsigned long nitems, after; + unsigned char *data; + Window inf = 0; - if (!XQueryTree(dpy, win, &root, &parent, &children, &nchildren)) - return 0; - for (i = 0; !inf && (i < nchildren); i++) { - XGetWindowProperty(dpy, children[i], WM_STATE, 0, 0, False, - AnyPropertyType, &type, &format, &nitems, - &after, &data); - if (type) - inf = children[i]; + if (!XQueryTree(dpy, win, &root, &parent, &children, &nchildren)) + return 0; + for (i = 0; !inf && (i < nchildren); i++) { + XGetWindowProperty(dpy, children[i], WM_STATE, 0, 0, False, + AnyPropertyType, &type, &format, &nitems, &after, &data); + if (type) + inf = children[i]; - XFree(data); - } - for (i = 0; !inf && (i < nchildren); i++) - inf = TryChildren(dpy, children[i], WM_STATE); - if (children) XFree((char *)children); - return inf; + XFree(data); + } + for (i = 0; !inf && (i < nchildren); i++) + inf = TryChildren(dpy, children[i], WM_STATE); + if (children) + XFree((char *)children); + return inf; } /* END X Consortium code */ @@ -194,332 +190,270 @@ if (!XA_MOZILLA_VERSION) XA_MOZILLA_VERSION = gdk_atom_intern(MOZILLA_VERSION_PROP, 0); if (!XA_MOZILLA_LOCK) - XA_MOZILLA_LOCK = gdk_atom_intern(MOZILLA_LOCK_PROP, 0); - if (! XA_MOZILLA_COMMAND) - XA_MOZILLA_COMMAND = gdk_atom_intern(MOZILLA_COMMAND_PROP, 0); - if (! XA_MOZILLA_RESPONSE) + XA_MOZILLA_LOCK = gdk_atom_intern(MOZILLA_LOCK_PROP, 0); + if (!XA_MOZILLA_COMMAND) + XA_MOZILLA_COMMAND = gdk_atom_intern(MOZILLA_COMMAND_PROP, 0); + if (!XA_MOZILLA_RESPONSE) XA_MOZILLA_RESPONSE = gdk_atom_intern(MOZILLA_RESPONSE_PROP, 0); } static GdkWindow *mozilla_remote_find_window() { - int i; - Window root = VirtualRootWindowOfScreen(DefaultScreenOfDisplay(gdk_display)); - Window root2, parent, *kids; - unsigned int nkids; - Window result = 0; - Window tenative = 0; - unsigned char *tenative_version = 0; + int i; + Window root = VirtualRootWindowOfScreen(DefaultScreenOfDisplay(gdk_display)); + Window root2, parent, *kids; + unsigned int nkids; + Window result = 0; + Window tenative = 0; + unsigned char *tenative_version = 0; - if (!XQueryTree (gdk_display, root, &root2, &parent, &kids, &nkids)) - { - sprintf (debug_buff, "%s: XQueryTree failed on display %s\n", progname, - DisplayString (gdk_display)); - debug_print(debug_buff); - return NULL; - } + if (!XQueryTree(gdk_display, root, &root2, &parent, &kids, &nkids)) { + debug_printf("%s: XQueryTree failed on display %s\n", progname, + DisplayString(gdk_display)); + return NULL; + } - /* root != root2 is possible with virtual root WMs. */ + /* root != root2 is possible with virtual root WMs. */ - if (!(kids && nkids)) { - sprintf (debug_buff, "%s: root window has no children on display %s\n", - progname, DisplayString (gdk_display)); - debug_print(debug_buff); - return NULL; - } + if (!(kids && nkids)) { + debug_printf("%s: root window has no children on display %s\n", + progname, DisplayString(gdk_display)); + return NULL; + } - for (i = nkids-1; i >= 0; i--) - { - Atom type; - int format; - unsigned long nitems, bytesafter; - unsigned char *version = 0; - Window w = GClientWindow (gdk_display, kids[i]); - int status = XGetWindowProperty (gdk_display, w, XA_MOZILLA_VERSION, - 0, (65536 / sizeof (long)), - False, XA_STRING, - &type, &format, &nitems, &bytesafter, - &version); + for (i = nkids - 1; i >= 0; i--) { + Atom type; + int format; + unsigned long nitems, bytesafter; + unsigned char *version = 0; + Window w = GClientWindow(gdk_display, kids[i]); + int status = XGetWindowProperty(gdk_display, w, XA_MOZILLA_VERSION, + 0, (65536 / sizeof(long)), + False, XA_STRING, + &type, &format, &nitems, &bytesafter, + &version); - if (! version) - continue; + if (!version) + continue; - if (strcmp ((char *) version, expected_mozilla_version) && - !tenative) - { - tenative = w; - tenative_version = version; - continue; - } - XFree(version); - if (status == Success && type != None) - { - result = w; - break; - } - } + if (strcmp((char *)version, expected_mozilla_version) && !tenative) { + tenative = w; + tenative_version = version; + continue; + } + XFree(version); + if (status == Success && type != None) { + result = w; + break; + } + } XFree(kids); - if (result && tenative) - { - sprintf (debug_buff, - "%s: warning: both version %s (0x%x) and version\n" - "\t%s (0x%x) are running. Using version %s.\n", - progname, tenative_version, (unsigned int) tenative, - expected_mozilla_version, (unsigned int) result, - expected_mozilla_version); - debug_print(debug_buff); - XFree(tenative_version); - return gdk_window_foreign_new(result); - } - else if (tenative) - { - sprintf (debug_buff, - "%s: warning: expected version %s but found version\n" - "\t%s (0x%x) instead.\n", - progname, expected_mozilla_version, - tenative_version, (unsigned int) tenative); - debug_print(debug_buff); - XFree(tenative_version); - return gdk_window_foreign_new(tenative); - } - else if (result) - { - return gdk_window_foreign_new(result); - } - else - { - sprintf (debug_buff, "%s: not running on display %s\n", progname, - DisplayString (gdk_display)); - debug_print(debug_buff); - return NULL; - } + if (result && tenative) { + debug_printf("%s: warning: both version %s (0x%x) and version\n" + "\t%s (0x%x) are running. Using version %s.\n", + progname, tenative_version, (unsigned int)tenative, + expected_mozilla_version, (unsigned int)result, expected_mozilla_version); + XFree(tenative_version); + return gdk_window_foreign_new(result); + } else if (tenative) { + debug_printf("%s: warning: expected version %s but found version\n" + "\t%s (0x%x) instead.\n", + progname, expected_mozilla_version, + tenative_version, (unsigned int)tenative); + XFree(tenative_version); + return gdk_window_foreign_new(tenative); + } else if (result) { + return gdk_window_foreign_new(result); + } else { + debug_printf("%s: not running on display %s\n", progname, DisplayString(gdk_display)); + return NULL; + } } static char *lock_data = 0; -static void mozilla_remote_obtain_lock (GdkWindow *window) +static void mozilla_remote_obtain_lock(GdkWindow * window) { - Bool locked = False; + Bool locked = False; - if (!lock_data) { - lock_data = (char *)g_malloc (255); - sprintf (lock_data, "pid%d@", getpid ()); - if (gethostname (lock_data + strlen (lock_data), 100)) { + if (!lock_data) { + lock_data = (char *)g_malloc(255); + sprintf(lock_data, "pid%d@", getpid()); + if (gethostname(lock_data + strlen(lock_data), 100)) { return; } } - do { - int result; - GdkAtom actual_type; - gint actual_format; + do { + int result; + GdkAtom actual_type; + gint actual_format; gint nitems; - unsigned char *data = 0; + unsigned char *data = 0; + + result = gdk_property_get(window, XA_MOZILLA_LOCK, + XA_STRING, 0, + (65536 / sizeof(long)), 0, + &actual_type, &actual_format, &nitems, &data); + if (result != Success || actual_type == None) { + /* It's not now locked - lock it. */ + debug_printf("%s: (writing " MOZILLA_LOCK_PROP + " \"%s\" to 0x%x)\n", progname, lock_data, (unsigned int)window); - result = gdk_property_get (window, XA_MOZILLA_LOCK, - XA_STRING, 0, - (65536 / sizeof (long)), 0, - &actual_type, &actual_format, - &nitems, &data); - if (result != Success || actual_type == None) - { - /* It's not now locked - lock it. */ - sprintf (debug_buff, "%s: (writing " MOZILLA_LOCK_PROP - " \"%s\" to 0x%x)\n", - progname, lock_data, (unsigned int) window); - debug_print(debug_buff); + gdk_property_change(window, XA_MOZILLA_LOCK, XA_STRING, + 8, PropModeReplace, + (unsigned char *)lock_data, strlen(lock_data)); + locked = True; + } - gdk_property_change(window, XA_MOZILLA_LOCK, XA_STRING, - 8, PropModeReplace, - (unsigned char *) lock_data, - strlen (lock_data)); - locked = True; - } - - if (!locked) { - /* Then just fuck it. */ - if (data) - g_free(data); - return; - } - if (data) - g_free(data); - } while (!locked); + if (!locked) { + /* Then just fuck it. */ + if (data) + g_free(data); + return; + } + if (data) + g_free(data); + } while (!locked); } -static void mozilla_remote_free_lock (GdkWindow *window) +static void mozilla_remote_free_lock(GdkWindow * window) { - int result = 0; - GdkAtom actual_type; - gint actual_format; - gint nitems; - unsigned char *data = 0; + int result = 0; + GdkAtom actual_type; + gint actual_format; + gint nitems; + unsigned char *data = 0; - sprintf (debug_buff, "%s: (deleting " MOZILLA_LOCK_PROP - " \"%s\" from 0x%x)\n", - progname, lock_data, (unsigned int) window); - debug_print(debug_buff); + debug_printf("%s: (deleting " MOZILLA_LOCK_PROP + " \"%s\" from 0x%x)\n", progname, lock_data, (unsigned int)window); - result = gdk_property_get(window, XA_MOZILLA_LOCK, XA_STRING, - 0, (65536 / sizeof (long)), - 1, &actual_type, &actual_format, - &nitems, &data); - if (result != Success) - { - sprintf (debug_buff, "%s: unable to read and delete " MOZILLA_LOCK_PROP - " property\n", - progname); - debug_print(debug_buff); - return; - } - else if (!data || !*data) - { - sprintf (debug_buff, "%s: invalid data on " MOZILLA_LOCK_PROP - " of window 0x%x.\n", - progname, (unsigned int) window); - debug_print(debug_buff); - return; - } - else if (strcmp ((char *) data, lock_data)) - { - sprintf (debug_buff, "%s: " MOZILLA_LOCK_PROP - " was stolen! Expected \"%s\", saw \"%s\"!\n", - progname, lock_data, data); - debug_print(debug_buff); - return; - } + result = gdk_property_get(window, XA_MOZILLA_LOCK, XA_STRING, + 0, (65536 / sizeof(long)), + 1, &actual_type, &actual_format, &nitems, &data); + if (result != Success) { + debug_printf("%s: unable to read and delete " MOZILLA_LOCK_PROP " property\n", progname); + return; + } else if (!data || !*data) { + debug_printf("%s: invalid data on " MOZILLA_LOCK_PROP + " of window 0x%x.\n", progname, (unsigned int)window); + return; + } else if (strcmp((char *)data, lock_data)) { + debug_printf("%s: " MOZILLA_LOCK_PROP + " was stolen! Expected \"%s\", saw \"%s\"!\n", progname, lock_data, data); + return; + } - if (data) - g_free(data); + if (data) + g_free(data); } -static int -mozilla_remote_command (GdkWindow *window, const char *command, - Bool raise_p) +static int mozilla_remote_command(GdkWindow * window, const char *command, Bool raise_p) { - int result = 0; - Bool done = False; - char *new_command = 0; + int result = 0; + Bool done = False; + char *new_command = 0; - /* The -noraise option is implemented by passing a "noraise" argument - to each command to which it should apply. - */ - if (!raise_p) - { - char *close; - new_command = g_malloc (strlen (command) + 20); - strcpy (new_command, command); - close = strrchr (new_command, ')'); - if (close) - strcpy (close, ", noraise)"); - else - strcat (new_command, "(noraise)"); - command = new_command; - } + /* The -noraise option is implemented by passing a "noraise" argument + to each command to which it should apply. + */ + if (!raise_p) { + char *close; + new_command = g_malloc(strlen(command) + 20); + strcpy(new_command, command); + close = strrchr(new_command, ')'); + if (close) + strcpy(close, ", noraise)"); + else + strcat(new_command, "(noraise)"); + command = new_command; + } - sprintf (debug_buff, "%s: (writing " MOZILLA_COMMAND_PROP " \"%s\" to 0x%x)\n", - progname, command, (unsigned int) window); - debug_print(debug_buff); + debug_printf("%s: (writing " MOZILLA_COMMAND_PROP " \"%s\" to 0x%x)\n", + progname, command, (unsigned int)window); gdk_property_change(window, XA_MOZILLA_COMMAND, XA_STRING, 8, - GDK_PROP_MODE_REPLACE, (unsigned char *) command, - strlen (command)); + GDK_PROP_MODE_REPLACE, (unsigned char *)command, strlen(command)); while (!done) { - GdkEvent *event; - - event = gdk_event_get(); - + GdkEvent *event; + + event = gdk_event_get(); + if (!event) continue; - + if (event->any.window != window) { gtk_main_do_event(event); continue; } - if (event->type == GDK_DESTROY && - event->any.window == window) { + if (event->type == GDK_DESTROY && event->any.window == window) { - /* Print to warn user...*/ - sprintf (debug_buff, "%s: window 0x%x was destroyed.\n", - progname, (unsigned int) window); - debug_print(debug_buff); - result = 6; - goto DONE; + /* Print to warn user... */ + debug_printf("%s: window 0x%x was destroyed.\n", progname, (unsigned int)window); + result = 6; + goto DONE; } else if (event->type == GDK_PROPERTY_NOTIFY && - event->property.state == GDK_PROPERTY_NEW_VALUE && - event->property.window == window && - event->property.atom == XA_MOZILLA_RESPONSE) { + event->property.state == GDK_PROPERTY_NEW_VALUE && + event->property.window == window && + event->property.atom == XA_MOZILLA_RESPONSE) { GdkAtom actual_type; gint actual_format, nitems; unsigned char *data = 0; - result = gdk_property_get (window, XA_MOZILLA_RESPONSE, - XA_STRING, 0, - (65536 / sizeof (long)), - 1, - &actual_type, &actual_format, - &nitems, &data); + result = gdk_property_get(window, XA_MOZILLA_RESPONSE, + XA_STRING, 0, + (65536 / sizeof(long)), + 1, &actual_type, &actual_format, &nitems, &data); - + if (result == Success && data && *data) { - sprintf (debug_buff, "%s: (server sent " MOZILLA_RESPONSE_PROP - " \"%s\" to 0x%x.)\n", - progname, data, (unsigned int) window); - debug_print(debug_buff); + debug_printf("%s: (server sent " MOZILLA_RESPONSE_PROP + " \"%s\" to 0x%x.)\n", + progname, data, (unsigned int)window); } if (result != Success) { - sprintf (debug_buff, "%s: failed reading " MOZILLA_RESPONSE_PROP - " from window 0x%0x.\n", - progname, (unsigned int) window); - debug_print(debug_buff); + debug_printf("%s: failed reading " MOZILLA_RESPONSE_PROP + " from window 0x%0x.\n", progname, (unsigned int)window); result = 6; done = True; - } else if (!data || strlen((char *) data) < 5) { - sprintf (debug_buff, "%s: invalid data on " MOZILLA_RESPONSE_PROP - " property of window 0x%0x.\n", - progname, (unsigned int) window); - debug_print(debug_buff); + } else if (!data || strlen((char *)data) < 5) { + debug_printf("%s: invalid data on " MOZILLA_RESPONSE_PROP + " property of window 0x%0x.\n", + progname, (unsigned int)window); result = 6; done = True; - } else if (*data == '1') { /* positive preliminary reply */ - sprintf (debug_buff, "%s: %s\n", progname, data + 4); - debug_print(debug_buff); + } else if (*data == '1') { /* positive preliminary reply */ + debug_printf("%s: %s\n", progname, data + 4); /* keep going */ done = False; - } else if (!strncmp ((char *)data, "200", 3)) { + } else if (!strncmp((char *)data, "200", 3)) { result = 0; done = True; } else if (*data == '2') { - sprintf (debug_buff, "%s: %s\n", progname, data + 4); - debug_print(debug_buff); + debug_printf("%s: %s\n", progname, data + 4); result = 0; done = True; } else if (*data == '3') { - sprintf (debug_buff, "%s: internal error: " - "server wants more information? (%s)\n", - progname, data); - debug_print(debug_buff); + debug_printf("%s: internal error: " + "server wants more information? (%s)\n", progname, data); result = 3; done = True; } else if (*data == '4' || *data == '5') { - sprintf (debug_buff, "%s: %s\n", progname, data + 4); - debug_print(debug_buff); + debug_printf("%s: %s\n", progname, data + 4); result = (*data - '0'); done = True; } else { - sprintf (debug_buff, - "%s: unrecognised " MOZILLA_RESPONSE_PROP - " from window 0x%x: %s\n", - progname, (unsigned int) window, data); - debug_print(debug_buff); + debug_printf("%s: unrecognised " MOZILLA_RESPONSE_PROP + " from window 0x%x: %s\n", + progname, (unsigned int)window, data); result = 6; done = True; } @@ -527,22 +461,20 @@ if (data) g_free(data); } - else if (event->type == GDK_PROPERTY_NOTIFY && - event->property.window == window && - event->property.state == GDK_PROPERTY_DELETE && - event->property.atom == XA_MOZILLA_COMMAND) { - sprintf (debug_buff, "%s: (server 0x%x has accepted " - MOZILLA_COMMAND_PROP ".)\n", - progname, (unsigned int) window); - debug_print(debug_buff); + else if (event->type == GDK_PROPERTY_NOTIFY && + event->property.window == window && + event->property.state == GDK_PROPERTY_DELETE && + event->property.atom == XA_MOZILLA_COMMAND) { + debug_printf("%s: (server 0x%x has accepted " + MOZILLA_COMMAND_PROP ".)\n", progname, (unsigned int)window); } gdk_event_free(event); } -DONE: + DONE: if (new_command) - g_free (new_command); + g_free(new_command); return result; } @@ -550,40 +482,40 @@ gint check_netscape(char *msg) { - int status; - GdkWindow *window; + int status; + GdkWindow *window; - mozilla_remote_init_atoms (); - window = mozilla_remote_find_window(); + mozilla_remote_init_atoms(); + window = mozilla_remote_find_window(); - if (window && (((GdkWindowPrivate *)window)->destroyed == FALSE)) { + if (window && (((GdkWindowPrivate *) window)->destroyed == FALSE)) { - XSelectInput(gdk_display, ((GdkWindowPrivate *)window)->xwindow, - (PropertyChangeMask|StructureNotifyMask)); + XSelectInput(gdk_display, ((GdkWindowPrivate *) window)->xwindow, + (PropertyChangeMask | StructureNotifyMask)); - - mozilla_remote_obtain_lock(window); + + mozilla_remote_obtain_lock(window); - status = mozilla_remote_command(window, msg, False); + status = mozilla_remote_command(window, msg, False); - if (status != 6) - mozilla_remote_free_lock(window); + if (status != 6) + mozilla_remote_free_lock(window); - gtk_timeout_add(1000, (GtkFunction)clean_pid, NULL); + gtk_timeout_add(1000, (GtkFunction)clean_pid, NULL); - netscape_lock = 0; - + netscape_lock = 0; + g_free(msg); - return FALSE; - } else - return TRUE; + return FALSE; + } else + return TRUE; } static void netscape_command(char *command) { - int status; - pid_t pid; + int status; + pid_t pid; GdkWindow *window; if (netscape_lock) @@ -596,10 +528,10 @@ mozilla_remote_init_atoms(); window = mozilla_remote_find_window(); - if (window && (((GdkWindowPrivate *)window)->destroyed == FALSE)) { + if (window && (((GdkWindowPrivate *) window)->destroyed == FALSE)) { - XSelectInput(gdk_display, ((GdkWindowPrivate *)window)->xwindow, - (PropertyChangeMask|StructureNotifyMask)); + XSelectInput(gdk_display, ((GdkWindowPrivate *) window)->xwindow, + (PropertyChangeMask | StructureNotifyMask)); mozilla_remote_obtain_lock(window); @@ -609,8 +541,8 @@ mozilla_remote_free_lock(window); netscape_lock = 0; - - gdk_window_destroy (window); + + gdk_window_destroy(window); } else { pid = fork(); if (pid == 0) { @@ -619,9 +551,9 @@ args[0] = g_strdup("netscape"); args[1] = NULL; - e = execvp(args[0], args); - printf("Hello%d\n", getppid()); - + e = execvp(args[0], args); + printf("Hello%d\n", getppid()); + _exit(0); } else { char *tmp = g_strdup(command); @@ -631,10 +563,11 @@ } -void open_url(GtkWidget *w, char *url) { +void open_url(GtkWidget *w, char *url) +{ if (web_browser == BROWSER_NETSCAPE) { - char *command = g_malloc(1024); + char *command = g_malloc(1024); g_snprintf(command, 1024, "OpenURL(%s)", url); @@ -650,7 +583,7 @@ args[0] = g_strdup("kfmclient"); args[1] = g_strdup("openURL"); - args[2] = url;; + args[2] = url;; args[3] = NULL; execvp(args[0], args); @@ -679,18 +612,19 @@ args[2] = command; args[3] = NULL; - execvp(args[0], args); + execvp(args[0], args); _exit(0); } else { gtk_timeout_add(1000, (GtkFunction)clean_pid, NULL); } - } + } } -void add_bookmark(GtkWidget *w, char *url) { +void add_bookmark(GtkWidget *w, char *url) +{ if (web_browser == BROWSER_NETSCAPE) { - char *command = g_malloc(1024); + char *command = g_malloc(1024); g_snprintf(command, 1024, "AddBookmark(%s)", url); @@ -699,9 +633,10 @@ } } -void open_url_nw(GtkWidget *w, char *url) { +void open_url_nw(GtkWidget *w, char *url) +{ if (web_browser == BROWSER_NETSCAPE) { - char *command = g_malloc(1024); + char *command = g_malloc(1024); g_snprintf(command, 1024, "OpenURL(%s, new-window)", url); @@ -716,9 +651,15 @@ /* Sooner or later, I shall support Windows clicking! */ -void add_bookmark(GtkWidget *w, char *url) { } -void open_url_nw(GtkWidget *w, char *url) { } -void open_url(GtkWidget *w, char *url) { } +void add_bookmark(GtkWidget *w, char *url) +{ +} +void open_url_nw(GtkWidget *w, char *url) +{ +} +void open_url(GtkWidget *w, char *url) +{ +} -#endif _WIN32 +#endif /* _WIN32 */
--- a/src/buddy.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/buddy.c Wed Dec 13 20:18:35 2000 +0000 @@ -321,8 +321,7 @@ shows = NULL; } - sprintf(debug_buff, "date: %s\n", full_date()); - debug_print(debug_buff); + debug_printf("date: %s\n", full_date()); destroy_all_dialogs(); destroy_buddy(); #ifdef USE_APPLET
--- a/src/buddy_chat.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/buddy_chat.c Wed Dec 13 20:18:35 2000 +0000 @@ -52,14 +52,14 @@ { if (joinchat) gtk_widget_destroy(joinchat); - joinchat=NULL; + joinchat = NULL; } static void destroy_invite() { if (invite) gtk_widget_destroy(invite); - invite=NULL; + invite = NULL; } @@ -69,11 +69,11 @@ group = gtk_entry_get_text(GTK_ENTRY(entry)); - if (joinchat) { - serv_join_chat(joinchatgc, community + 4, group); + if (joinchat) { + serv_join_chat(joinchatgc, community + 4, group); gtk_widget_destroy(joinchat); } - joinchat=NULL; + joinchat = NULL; } static void joinchat_choose(GtkWidget *w, struct gaim_connection *g) @@ -128,22 +128,21 @@ if (!joinchat) { joinchat = gtk_window_new(GTK_WINDOW_DIALOG); - gtk_window_set_wmclass(GTK_WINDOW(joinchat), "joinchat", - "Gaim"); + gtk_window_set_wmclass(GTK_WINDOW(joinchat), "joinchat", "Gaim"); gtk_window_set_policy(GTK_WINDOW(joinchat), FALSE, TRUE, TRUE); gtk_widget_realize(joinchat); gtk_signal_connect(GTK_OBJECT(joinchat), "delete_event", - GTK_SIGNAL_FUNC(destroy_join_chat), joinchat); + GTK_SIGNAL_FUNC(destroy_join_chat), joinchat); gtk_window_set_title(GTK_WINDOW(joinchat), _("Join Chat")); aol_icon(joinchat->window); - mainbox = gtk_vbox_new(FALSE, 5); + mainbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(mainbox), 5); gtk_container_add(GTK_CONTAINER(joinchat), mainbox); frame = gtk_frame_new(_("Buddy Chat")); - gtk_box_pack_start(GTK_BOX(mainbox), frame, TRUE, TRUE, 0); - + gtk_box_pack_start(GTK_BOX(mainbox), frame, TRUE, TRUE, 0); + fbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); gtk_container_add(GTK_CONTAINER(frame), fbox); @@ -157,7 +156,7 @@ entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(rowbox), entry, TRUE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(entry), "activate", - GTK_SIGNAL_FUNC(do_join_chat), joinchat); + GTK_SIGNAL_FUNC(do_join_chat), joinchat); gtk_window_set_focus(GTK_WINDOW(joinchat), entry); #ifndef NO_MULTI @@ -182,25 +181,23 @@ gtk_signal_connect(GTK_OBJECT(opt), "clicked", set_option, &community); gtk_widget_show(opt); - opt = gtk_radio_button_new_with_label( - gtk_radio_button_group(GTK_RADIO_BUTTON(opt)), - _("AOL Community Chats")); + opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(opt)), + _("AOL Community Chats")); gtk_box_pack_start(GTK_BOX(rowbox), opt, TRUE, TRUE, 0); - /* buttons */ + /* buttons */ bbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(mainbox), bbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(mainbox), bbox, FALSE, FALSE, 0); cancel = picture_button(joinchat, _("Cancel"), cancel_xpm); gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(cancel), "clicked", - GTK_SIGNAL_FUNC(destroy_join_chat), joinchat); + GTK_SIGNAL_FUNC(destroy_join_chat), joinchat); join = picture_button(joinchat, _("Join"), join_xpm); gtk_box_pack_end(GTK_BOX(bbox), join, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(join), "clicked", - GTK_SIGNAL_FUNC(do_join_chat), joinchat); + gtk_signal_connect(GTK_OBJECT(join), "clicked", GTK_SIGNAL_FUNC(do_join_chat), joinchat); } gtk_widget_show_all(joinchat); } @@ -212,18 +209,18 @@ char *mess; if (!b->is_chat) { - debug_print("do_invite: expecting chat, got IM\n"); + debug_printf("do_invite: expecting chat, got IM\n"); return; } buddy = gtk_entry_get_text(GTK_ENTRY(inviteentry)); mess = gtk_entry_get_text(GTK_ENTRY(invitemess)); - if (invite) { - serv_chat_invite(b->gc, b->id, mess, buddy); + if (invite) { + serv_chat_invite(b->gc, b->id, mess, buddy); gtk_widget_destroy(invite); } - invite=NULL; + invite = NULL; } @@ -246,8 +243,7 @@ inviteentry = gtk_entry_new(); invitemess = gtk_entry_new(); - if (display_options & OPT_DISP_COOL_LOOK) - { + if (display_options & OPT_DISP_COOL_LOOK) { gtk_button_set_relief(GTK_BUTTON(cancel), GTK_RELIEF_NONE); gtk_button_set_relief(GTK_BUTTON(invite_btn), GTK_RELIEF_NONE); } @@ -255,7 +251,7 @@ /* Put the buttons in the box */ gtk_box_pack_start(GTK_BOX(bbox), invite_btn, TRUE, TRUE, 10); gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 10); - + label = gtk_label_new(_("Invite who?")); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); @@ -264,21 +260,18 @@ gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(topbox), label, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(topbox), invitemess, FALSE, FALSE, 5); - + /* And the boxes in the box */ gtk_box_pack_start(GTK_BOX(vbox), topbox, TRUE, TRUE, 5); gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); - + /* Handle closes right */ gtk_signal_connect(GTK_OBJECT(invite), "delete_event", - GTK_SIGNAL_FUNC(destroy_invite), invite); + GTK_SIGNAL_FUNC(destroy_invite), invite); - gtk_signal_connect(GTK_OBJECT(cancel), "clicked", - GTK_SIGNAL_FUNC(destroy_invite), b); - gtk_signal_connect(GTK_OBJECT(invite_btn), "clicked", - GTK_SIGNAL_FUNC(do_invite), b); - gtk_signal_connect(GTK_OBJECT(inviteentry), "activate", - GTK_SIGNAL_FUNC(do_invite), b); + gtk_signal_connect(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(destroy_invite), b); + gtk_signal_connect(GTK_OBJECT(invite_btn), "clicked", GTK_SIGNAL_FUNC(do_invite), b); + gtk_signal_connect(GTK_OBJECT(inviteentry), "activate", GTK_SIGNAL_FUNC(do_invite), b); /* Finish up */ gtk_widget_show(invite_btn); gtk_widget_show(cancel); @@ -289,33 +282,39 @@ gtk_widget_show(vbox); gtk_window_set_title(GTK_WINDOW(invite), _("Invite to Buddy Chat")); gtk_window_set_focus(GTK_WINDOW(invite), inviteentry); - gtk_container_add(GTK_CONTAINER(invite), vbox); - gtk_widget_realize(invite); + gtk_container_add(GTK_CONTAINER(invite), vbox); + gtk_widget_realize(invite); aol_icon(invite->window); } gtk_widget_show(invite); } -gboolean meify(char *message) { +gboolean meify(char *message) +{ /* read /me-ify : if the message (post-HTML) starts with /me, remove * the "/me " part of it (including that space) and return TRUE */ char *c = message; - int inside_HTML = 0; /* i really don't like descriptive names */ - if (!c) return FALSE; /* um... this would be very bad if this happens */ + int inside_HTML = 0; /* i really don't like descriptive names */ + if (!c) + return FALSE; /* um... this would be very bad if this happens */ while (*c) { if (inside_HTML) { - if (*c == '>') inside_HTML = 0; + if (*c == '>') + inside_HTML = 0; } else { - if (*c == '<') inside_HTML = 1; - else break; + if (*c == '<') + inside_HTML = 1; + else + break; } - c++; /* i really don't like c++ either */ + c++; /* i really don't like c++ either */ } /* k, so now we've gotten past all the HTML crap. */ - if (!*c) return FALSE; + if (!*c) + return FALSE; if (!strncmp(c, "/me ", 4)) { - sprintf(c, "%s", c+4); + sprintf(c, "%s", c + 4); return TRUE; } else return FALSE; @@ -323,26 +322,25 @@ void chat_write(struct conversation *b, char *who, int flag, char *message) { - GList *ignore = b->ignored; + GList *ignore = b->ignored; char *str; if (!b->is_chat) { - debug_print("chat_write: expecting chat, got IM\n"); + debug_printf("chat_write: expecting chat, got IM\n"); return; } - while(ignore) { - if (!strcasecmp(who, ignore->data)) - return; - ignore = ignore->next; - } + while (ignore) { + if (!strcasecmp(who, ignore->data)) + return; + ignore = ignore->next; + } - - if (!(flag & WFLAG_WHISPER)) { + + if (!(flag & WFLAG_WHISPER)) { str = g_strdup(normalize(who)); if (!strcasecmp(str, normalize(b->gc->username))) { - sprintf(debug_buff, "%s %s\n", normalize(who), normalize(b->gc->username)); - debug_print(debug_buff); + debug_printf("%s %s\n", normalize(who), normalize(b->gc->username)); if (b->makesound && (sound_options & OPT_SOUND_CHAT_YOU_SAY)) play_sound(CHAT_YOU_SAY); flag |= WFLAG_SEND; @@ -352,7 +350,7 @@ flag |= WFLAG_RECV; } g_free(str); - } + } write_to_conv(b, message, flag, who); } @@ -361,12 +359,12 @@ void whisper_callback(GtkWidget *widget, struct conversation *b) { - char buf[BUF_LEN*4]; + char buf[BUF_LEN * 4]; char buf2[BUF_LONG]; GList *selected; char *who; - strncpy(buf, gtk_editable_get_chars(GTK_EDITABLE(b->entry), 0, -1), sizeof(buf)/2); + strncpy(buf, gtk_editable_get_chars(GTK_EDITABLE(b->entry), 0, -1), sizeof(buf) / 2); if (!strlen(buf)) return; @@ -374,7 +372,7 @@ if (!selected) return; - + who = GTK_LABEL(gtk_container_children(GTK_CONTAINER(selected->data))->data)->label; @@ -383,9 +381,9 @@ gtk_editable_delete_text(GTK_EDITABLE(b->entry), 0, -1); - escape_text(buf); /* it's ok to leave this here because oscar can't whisper */ - serv_chat_whisper(b->gc, b->id, who, buf); - + escape_text(buf); /* it's ok to leave this here because oscar can't whisper */ + serv_chat_whisper(b->gc, b->id, who, buf); + g_snprintf(buf2, sizeof(buf2), "%s->%s", b->gc->username, who); chat_write(b, buf2, WFLAG_WHISPER, buf); @@ -421,16 +419,16 @@ void add_chat_buddy(struct conversation *b, char *buddy) { - char *name = g_strdup(buddy); + char *name = g_strdup(buddy); char tmp[BUF_LONG]; GtkWidget *list_item; int pos; plugin_event(event_chat_buddy_join, b->gc, b->name, name, 0); - b->in_room = g_list_insert_sorted(b->in_room, name, insertname); + b->in_room = g_list_insert_sorted(b->in_room, name, insertname); pos = g_list_index(b->in_room, name); - list_item = gtk_list_item_new_with_label(name); + list_item = gtk_list_item_new_with_label(name); gtk_object_set_user_data(GTK_OBJECT(list_item), name); gtk_list_insert_items(GTK_LIST(b->list), g_list_append(NULL, list_item), pos); gtk_widget_show(list_item); @@ -451,31 +449,31 @@ void remove_chat_buddy(struct conversation *b, char *buddy) -{ - GList *names = b->in_room; +{ + GList *names = b->in_room; GList *items = GTK_LIST(b->list)->children; - + char tmp[BUF_LONG]; plugin_event(event_chat_buddy_leave, b->gc, b->name, buddy, 0); - while(names) { - if (!strcasecmp((char *)names->data, buddy)) { + while (names) { + if (!strcasecmp((char *)names->data, buddy)) { char *tmp = names->data; - b->in_room = g_list_remove(b->in_room, names->data); + b->in_room = g_list_remove(b->in_room, names->data); while (items) { if (tmp == gtk_object_get_user_data(items->data)) { gtk_list_remove_items(GTK_LIST(b->list), - g_list_append(NULL, items->data)); + g_list_append(NULL, items->data)); break; } items = items->next; } g_free(tmp); - break; - } - names = names->next; - } + break; + } + names = names->next; + } g_snprintf(tmp, sizeof(tmp), _("%d people in room"), g_list_length(b->in_room)); gtk_label_set_text(GTK_LABEL(b->count), tmp); @@ -492,15 +490,15 @@ void im_callback(GtkWidget *w, struct conversation *b) { - char *name; - GList *i; - struct conversation *c; + char *name; + GList *i; + struct conversation *c; - i = GTK_LIST(b->list)->selection; - if (i) - name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data)); - else - return; + i = GTK_LIST(b->list)->selection; + if (i) + name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data)); + else + return; c = find_conversation(name); @@ -510,30 +508,30 @@ c = new_conversation(name); } - + } void ignore_callback(GtkWidget *w, struct conversation *b) { - char *name; - GList *i; + char *name; + GList *i; int pos; GtkWidget *list_item; char tmp[80]; - i = GTK_LIST(b->list)->selection; - if (i) - name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data)); - else - return; + i = GTK_LIST(b->list)->selection; + if (i) + name = (char *)gtk_object_get_user_data(GTK_OBJECT(i->data)); + else + return; pos = gtk_list_child_position(GTK_LIST(b->list), i->data); - if (g_list_index(b->ignored, (gpointer)name) == -1) { - b->ignored = g_list_append(b->ignored, name); + if (g_list_index(b->ignored, (gpointer)name) == -1) { + b->ignored = g_list_append(b->ignored, name); g_snprintf(tmp, sizeof tmp, "X %s", name); } else { - b->ignored = g_list_remove(b->ignored, name); + b->ignored = g_list_remove(b->ignored, name); g_snprintf(tmp, sizeof tmp, "%s", name); } @@ -581,19 +579,17 @@ aol_icon(win->window); vpaned = gtk_vpaned_new(); - gtk_paned_set_gutter_size(GTK_PANED(vpaned), 15); - gtk_container_add(GTK_CONTAINER(win),vpaned); - gtk_widget_show( vpaned ); + gtk_paned_set_gutter_size(GTK_PANED(vpaned), 15); + gtk_container_add(GTK_CONTAINER(win), vpaned); + gtk_widget_show(vpaned); hpaned = gtk_hpaned_new(); - gtk_paned_set_gutter_size(GTK_PANED(hpaned), 15); + gtk_paned_set_gutter_size(GTK_PANED(hpaned), 15); gtk_paned_pack1(GTK_PANED(vpaned), hpaned, TRUE, FALSE); - gtk_widget_show( hpaned ); + gtk_widget_show(hpaned); - sw = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), - GTK_POLICY_NEVER, - GTK_POLICY_ALWAYS); + sw = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); gtk_paned_pack1(GTK_PANED(hpaned), sw, TRUE, TRUE); gtk_widget_set_usize(sw, 320, 160); gtk_widget_show(sw); @@ -602,8 +598,8 @@ b->text = text; gtk_container_add(GTK_CONTAINER(sw), text); gtk_widget_show(text); - GTK_HTML (text)->hadj->step_increment = 10.0; - GTK_HTML (text)->vadj->step_increment = 10.0; + GTK_HTML(text)->hadj->step_increment = 10.0; + GTK_HTML(text)->vadj->step_increment = 10.0; lbox = gtk_vbox_new(FALSE, 5); gtk_paned_pack2(GTK_PANED(hpaned), lbox, TRUE, TRUE); @@ -614,9 +610,7 @@ gtk_widget_show(b->count); sw2 = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), - GTK_POLICY_NEVER, - GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_box_pack_start(GTK_BOX(lbox), sw2, TRUE, TRUE, 0); gtk_widget_show(sw2); @@ -646,7 +640,7 @@ gtk_paned_pack2(GTK_PANED(vpaned), vbox, TRUE, FALSE); gtk_widget_show(vbox); - chatentry = gtk_text_new( NULL, NULL ); + chatentry = gtk_text_new(NULL, NULL); b->entry = chatentry; toolbar = build_conv_toolbar(b); @@ -655,9 +649,11 @@ gtk_object_set_user_data(GTK_OBJECT(chatentry), b); gtk_text_set_editable(GTK_TEXT(chatentry), TRUE); gtk_text_set_word_wrap(GTK_TEXT(chatentry), TRUE); - gtk_signal_connect(GTK_OBJECT(chatentry), "activate", GTK_SIGNAL_FUNC(send_callback),b); - gtk_signal_connect(GTK_OBJECT(chatentry), "key_press_event", GTK_SIGNAL_FUNC(keypress_callback), b); - gtk_signal_connect(GTK_OBJECT(chatentry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed), chatentry); + gtk_signal_connect(GTK_OBJECT(chatentry), "activate", GTK_SIGNAL_FUNC(send_callback), b); + gtk_signal_connect(GTK_OBJECT(chatentry), "key_press_event", GTK_SIGNAL_FUNC(keypress_callback), + b); + gtk_signal_connect(GTK_OBJECT(chatentry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed), + chatentry); if (general_options & OPT_GEN_CHECK_SPELLING) gtkspell_attach(GTK_TEXT(chatentry)); gtk_box_pack_start(GTK_BOX(vbox), chatentry, TRUE, TRUE, 0); @@ -668,15 +664,15 @@ gtk_window_set_focus(GTK_WINDOW(win), chatentry); gtk_widget_show(chatentry); - bbox = gtk_hbox_new(FALSE, 5); + bbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); - gtk_widget_show(bbox); + gtk_widget_show(bbox); close = picture_button2(win, _("Close"), cancel_xpm, dispstyle); b->close = close; gtk_object_set_user_data(GTK_OBJECT(close), b); - gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback),b); - gtk_box_pack_end(GTK_BOX(bbox), close, dispstyle, dispstyle, 0); + gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_callback), b); + gtk_box_pack_end(GTK_BOX(bbox), close, dispstyle, dispstyle, 0); invite_btn = picture_button2(win, _("Invite"), join_xpm, dispstyle); b->invite = invite_btn; @@ -688,14 +684,14 @@ gtk_signal_connect(GTK_OBJECT(whisper), "clicked", GTK_SIGNAL_FUNC(whisper_callback), b); gtk_box_pack_end(GTK_BOX(bbox), whisper, dispstyle, dispstyle, 0); - send = picture_button2(win, _("Send"), tmp_send_xpm, dispstyle); + send = picture_button2(win, _("Send"), tmp_send_xpm, dispstyle); b->send = send; - gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback),b); + gtk_signal_connect(GTK_OBJECT(send), "clicked", GTK_SIGNAL_FUNC(send_callback), b); gtk_box_pack_end(GTK_BOX(bbox), send, dispstyle, dispstyle, 0); b->font_dialog = NULL; - b->fg_color_dialog = NULL; - b->bg_color_dialog = NULL; + b->fg_color_dialog = NULL; + b->bg_color_dialog = NULL; b->smiley_dialog = NULL; b->link_dialog = NULL; b->log_dialog = NULL; @@ -705,71 +701,70 @@ b->hasbg = 0; b->fgcol = fgcolor; b->hasfg = 0; - + gtk_widget_show(win); } -void handle_click_chat(GtkWidget *widget, GdkEventButton *event, struct chat_room *cr) +void handle_click_chat(GtkWidget *widget, GdkEventButton * event, struct chat_room *cr) { - if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { + if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { /* FIXME : double click on chat in buddy list */ - serv_join_chat(connections->data, cr->exchange, cr->name); - } + serv_join_chat(connections->data, cr->exchange, cr->name); + } } void setup_buddy_chats() { - GList *list; - struct chat_room *cr; - GList *crs = chat_rooms; - GtkWidget *w; - GtkWidget *item; - GtkWidget *tree; + GList *list; + struct chat_room *cr; + GList *crs = chat_rooms; + GtkWidget *w; + GtkWidget *item; + GtkWidget *tree; if (buddies == NULL) return; list = GTK_TREE(buddies)->children; - while(list) { - w = (GtkWidget *)list->data; - if (!strcmp(GTK_LABEL(GTK_BIN(w)->child)->label, _("Buddy Chat"))) { - gtk_tree_remove_items(GTK_TREE(buddies), list); - list = GTK_TREE(buddies)->children; - if (!list) - break; - } - list = list->next; - } + while (list) { + w = (GtkWidget *)list->data; + if (!strcmp(GTK_LABEL(GTK_BIN(w)->child)->label, _("Buddy Chat"))) { + gtk_tree_remove_items(GTK_TREE(buddies), list); + list = GTK_TREE(buddies)->children; + if (!list) + break; + } + list = list->next; + } - if (crs == NULL) - return; + if (crs == NULL) + return; - item = gtk_tree_item_new_with_label(_("Buddy Chat")); - tree = gtk_tree_new(); - gtk_widget_show(item); - gtk_widget_show(tree); - gtk_tree_append(GTK_TREE(buddies), item); - gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), tree); - gtk_tree_item_expand(GTK_TREE_ITEM(item)); + item = gtk_tree_item_new_with_label(_("Buddy Chat")); + tree = gtk_tree_new(); + gtk_widget_show(item); + gtk_widget_show(tree); + gtk_tree_append(GTK_TREE(buddies), item); + gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), tree); + gtk_tree_item_expand(GTK_TREE_ITEM(item)); - while (crs) { - cr = (struct chat_room *)crs->data; + while (crs) { + cr = (struct chat_room *)crs->data; - item = gtk_tree_item_new_with_label(cr->name); - gtk_object_set_user_data(GTK_OBJECT(item), cr); - gtk_tree_append(GTK_TREE(tree), item); - gtk_widget_show(item); - gtk_signal_connect(GTK_OBJECT(item), "button_press_event", - GTK_SIGNAL_FUNC(handle_click_chat), - cr); + item = gtk_tree_item_new_with_label(cr->name); + gtk_object_set_user_data(GTK_OBJECT(item), cr); + gtk_tree_append(GTK_TREE(tree), item); + gtk_widget_show(item); + gtk_signal_connect(GTK_OBJECT(item), "button_press_event", + GTK_SIGNAL_FUNC(handle_click_chat), cr); - crs = crs->next; + crs = crs->next; - } + } } @@ -802,14 +797,19 @@ while (bcs) { c = (struct conversation *)bcs->data; c->send = change_text(c->window, _("Send"), c->send, tmp_send_xpm, opt); - c->whisper = change_text(c->window, _("Whisper"), c->whisper, tb_forward_xpm, opt); + c->whisper = + change_text(c->window, _("Whisper"), c->whisper, tb_forward_xpm, opt); c->invite = change_text(c->window, _("Invite"), c->invite, join_xpm, opt); c->close = change_text(c->window, _("Close"), c->close, cancel_xpm, opt); gtk_object_set_user_data(GTK_OBJECT(c->close), c); - gtk_signal_connect(GTK_OBJECT(c->close), "clicked", GTK_SIGNAL_FUNC(close_callback),c); - gtk_signal_connect(GTK_OBJECT(c->send), "clicked", GTK_SIGNAL_FUNC(send_callback),c); - gtk_signal_connect(GTK_OBJECT(c->invite), "clicked", GTK_SIGNAL_FUNC(invite_callback),c); - gtk_signal_connect(GTK_OBJECT(c->whisper), "clicked", GTK_SIGNAL_FUNC(whisper_callback),c); + gtk_signal_connect(GTK_OBJECT(c->close), "clicked", + GTK_SIGNAL_FUNC(close_callback), c); + gtk_signal_connect(GTK_OBJECT(c->send), "clicked", + GTK_SIGNAL_FUNC(send_callback), c); + gtk_signal_connect(GTK_OBJECT(c->invite), "clicked", + GTK_SIGNAL_FUNC(invite_callback), c); + gtk_signal_connect(GTK_OBJECT(c->whisper), "clicked", + GTK_SIGNAL_FUNC(whisper_callback), c); bcs = bcs->next; } C = C->next; @@ -829,9 +829,10 @@ parent = c->close->parent; c->close = change_text(c->window, _("Close"), c->close, cancel_xpm, opt); gtk_box_reorder_child(GTK_BOX(parent), c->close, 0); - gtk_box_set_child_packing(GTK_BOX(parent), c->sep1, dispstyle, dispstyle, 0, GTK_PACK_END); + gtk_box_set_child_packing(GTK_BOX(parent), c->sep1, dispstyle, dispstyle, 0, + GTK_PACK_END); if (find_buddy(c->gc, c->name) == NULL) - c->add = change_text(c->window, _("Add"), c->add, gnome_add_xpm, opt); + c->add = change_text(c->window, _("Add"), c->add, gnome_add_xpm, opt); else c->add = change_text(c->window, _("Remove"), c->add, gnome_remove_xpm, opt); gtk_box_reorder_child(GTK_BOX(parent), c->add, 2); @@ -842,15 +843,16 @@ c->info = change_text(c->window, _("Info"), c->info, tb_search_xpm, opt); gtk_box_reorder_child(GTK_BOX(parent), c->info, 5); c->send = change_text(c->window, _("Send"), c->send, tmp_send_xpm, opt); - gtk_box_set_child_packing(GTK_BOX(parent), c->sep2, dispstyle, dispstyle, 0, GTK_PACK_END); + gtk_box_set_child_packing(GTK_BOX(parent), c->sep2, dispstyle, dispstyle, 0, + GTK_PACK_END); gtk_box_reorder_child(GTK_BOX(parent), c->send, 7); gtk_object_set_user_data(GTK_OBJECT(c->close), c); - gtk_signal_connect(GTK_OBJECT(c->close), "clicked", GTK_SIGNAL_FUNC(close_callback),c); - gtk_signal_connect(GTK_OBJECT(c->send), "clicked", GTK_SIGNAL_FUNC(send_callback),c); - gtk_signal_connect(GTK_OBJECT(c->add), "clicked", GTK_SIGNAL_FUNC(add_callback),c); - gtk_signal_connect(GTK_OBJECT(c->info), "clicked", GTK_SIGNAL_FUNC(info_callback),c); - gtk_signal_connect(GTK_OBJECT(c->warn), "clicked", GTK_SIGNAL_FUNC(warn_callback),c); - gtk_signal_connect(GTK_OBJECT(c->block), "clicked", GTK_SIGNAL_FUNC(block_callback),c); + gtk_signal_connect(GTK_OBJECT(c->close), "clicked", GTK_SIGNAL_FUNC(close_callback), c); + gtk_signal_connect(GTK_OBJECT(c->send), "clicked", GTK_SIGNAL_FUNC(send_callback), c); + gtk_signal_connect(GTK_OBJECT(c->add), "clicked", GTK_SIGNAL_FUNC(add_callback), c); + gtk_signal_connect(GTK_OBJECT(c->info), "clicked", GTK_SIGNAL_FUNC(info_callback), c); + gtk_signal_connect(GTK_OBJECT(c->warn), "clicked", GTK_SIGNAL_FUNC(warn_callback), c); + gtk_signal_connect(GTK_OBJECT(c->block), "clicked", GTK_SIGNAL_FUNC(block_callback), c); bcs = bcs->next; } }
--- a/src/conversation.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/conversation.c Wed Dec 13 20:18:35 2000 +0000 @@ -339,13 +339,13 @@ { if (c->is_chat && (widget == c->close)) { GtkWidget *tmp = c->window; - debug_print("chat clicked close button\n"); + debug_printf("chat clicked close button\n"); c->window = NULL; gtk_widget_destroy(tmp); return FALSE; } - debug_print("conversation close callback\n"); + debug_printf("conversation close callback\n"); if (general_options & OPT_GEN_CHECK_SPELLING) gtkspell_detach(GTK_TEXT(c->entry)); @@ -424,8 +424,7 @@ void add_callback(GtkWidget *widget, struct conversation *c) { if (c->gc && find_buddy(c->gc, c->name) != NULL) { - sprintf(debug_buff,_("Removing '%s' from buddylist.\n"), c->name); - debug_print(debug_buff); + debug_printf(_("Removing '%s' from buddylist.\n"), c->name); remove_buddy(c->gc, find_group_by_buddy(c->gc, c->name), find_buddy(c->gc, c->name)); build_edit_tree(); update_convo_add_button(c); @@ -900,8 +899,7 @@ return; s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); pos = GTK_EDITABLE(entry)->current_pos; - sprintf(debug_buff, _("Currently at %d, "), pos); - debug_print(debug_buff); + debug_printf(_("Currently at %d, "), pos); s2= strstr(&s[pos], post); if (s2) { pos = s2 - s + strlen(post); @@ -909,8 +907,7 @@ gtk_editable_insert_text(GTK_EDITABLE(entry), post, strlen(post), &pos); } g_free(s); - sprintf(debug_buff, _("Setting position to %d\n"), pos); - debug_print(debug_buff); + debug_printf(_("Setting position to %d\n"), pos); gtk_editable_set_position(GTK_EDITABLE(entry), pos); gtk_widget_grab_focus(entry); }
--- a/src/dialogs.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/dialogs.c Wed Dec 13 20:18:35 2000 +0000 @@ -2474,8 +2474,7 @@ c->hasfg = 1; g_snprintf(open_tag, 23, "<FONT COLOR=\"#%02X%02X%02X\">", text_color.red, text_color.green, text_color.blue); surround(c->entry, open_tag, "</FONT>"); - sprintf(debug_buff,"#%02X%02X%02X\n", text_color.red, text_color.green, text_color.blue); - debug_print(debug_buff); + debug_printf("#%02X%02X%02X\n", text_color.red, text_color.green, text_color.blue); g_free(open_tag); cancel_fgcolor(NULL, c); } @@ -2502,8 +2501,7 @@ c->hasbg = 1; g_snprintf(open_tag, 25, "<BODY BGCOLOR=\"#%02X%02X%02X\">", text_color.red, text_color.green, text_color.blue); surround(c->entry, open_tag, "</BODY>"); - sprintf(debug_buff,"#%02X%02X%02X\n", text_color.red, text_color.green, text_color.blue); - debug_print(debug_buff); + debug_printf("#%02X%02X%02X\n", text_color.red, text_color.green, text_color.blue); g_free(open_tag); cancel_bgcolor(NULL, c); } @@ -2657,8 +2655,7 @@ } font[k] = '\0'; - sprintf(debug_buff, "Setting font face %s\n", font); - debug_print(debug_buff); + debug_printf("Setting font face %s\n", font); set_font_face(font, c); } @@ -2772,12 +2769,10 @@ if ( file != (char *) NULL ) { sprintf(path, "%s/%s.blist", file, g_screenname); if ( !stat(path, &sbuf) ) { - sprintf(debug_buff, "%s exists.\n", path); - debug_print(debug_buff); + debug_printf("%s exists.\n", path); ret = TRUE; } else { - sprintf(debug_buff, "%s does not exist.\n", path); - debug_print(debug_buff); + debug_printf("%s does not exist.\n", path); } g_free(file); } @@ -2837,15 +2832,13 @@ g_screenname[i] = '\0'; sprintf(path, "%s/%s.blist", file, g_screenname); if ((f = fopen(path,"w"))) { - sprintf(debug_buff, "writing %s\n", path); - debug_print(debug_buff); + debug_printf("writing %s\n", path); toc_build_config(g, buf, 8192 - 1, TRUE); fprintf(f, "%s\n", buf); fclose(f); chmod(buf, S_IRUSR | S_IWUSR); } else { - sprintf(debug_buff, "unable to write %s\n", path); - debug_print(debug_buff); + debug_printf("unable to write %s\n", path); } c = c->next; @@ -2936,8 +2929,7 @@ destroy_dialog(NULL, importdialog); importdialog = NULL; } - sprintf(debug_buff, "Unable to open %s.\n", path); - debug_print(debug_buff); + debug_printf("Unable to open %s.\n", path); g_free(buf); g_free(first); return; @@ -2947,22 +2939,20 @@ /* AIM 4 buddy list */ if (!strcasecmp(first, "Config {\n")) { - debug_print("aim 4\n"); + debug_printf("aim 4\n"); rewind(f); translate_blt (f, buf); - sprintf(debug_buff, "%s\n", buf); - debug_print(debug_buff); + debug_printf("%s\n", buf); buf2 = buf; buf = g_malloc(8193); g_snprintf(buf, 8192, "toc_set_config {%s}\n", buf2); g_free(buf2); /* AIM 3 buddy list */ } else if (strstr(first, "group") != NULL) { - debug_print("aim 3\n"); + debug_printf("aim 3\n"); rewind(f); translate_lst (f, buf); - sprintf(debug_buff, "%s\n", buf); - debug_print(debug_buff); + debug_printf("%s\n", buf); buf2 = buf; buf = g_malloc(8193); g_snprintf(buf, 8192, "toc_set_config {%s}\n", buf2);
--- a/src/gaim.h Wed Dec 13 06:39:24 2000 +0000 +++ b/src/gaim.h Wed Dec 13 20:18:35 2000 +0000 @@ -507,7 +507,6 @@ extern GList *aim_users; extern char sound_cmd[2048]; extern char web_command[2048]; -extern char debug_buff[BUF_LONG]; extern struct save_pos blist_pos; extern char latest_ver[25]; @@ -710,7 +709,6 @@ extern int plugin_event(enum gaim_event, void *, void *, void *, void *); /* Functions in prefs.c */ -extern void debug_print( char * chars ); extern void debug_printf( char * fmt, ... ); extern void set_general_option(GtkWidget *, int *); extern void set_option(GtkWidget *, int *);
--- a/src/gaimrc.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/gaimrc.c Wed Dec 13 20:18:35 2000 +0000 @@ -51,78 +51,77 @@ char sound_cmd[2048]; struct parse { - char option[256]; - char value[MAX_VALUES][256]; + char option[256]; + char value[MAX_VALUES][256]; }; static struct parse *parse_line(char *line) { - char *c = line; - int inopt = 1, inval = 0, curval = -1; - int optlen = 0, vallen = 0; - static struct parse p; - int x; + char *c = line; + int inopt = 1, inval = 0, curval = -1; + int optlen = 0, vallen = 0; + static struct parse p; + int x; for (x = 0; x < MAX_VALUES; x++) { p.value[x][0] = 0; } - - - while(*c) { - if (*c == '\t') { - c++; - continue; - } - if (inopt) { - // if ((*c < 'a' || *c > 'z') && *c != '_') { - if ((*c < 'a' || *c > 'z') && *c != '_' && (*c < 'A' || *c > 'Z')) { - inopt = 0; - p.option[optlen] = 0; - c++; - continue; - } + - p.option[optlen] = *c; - optlen++; - c++; - continue; - } else if (inval) { - if ( (*c == '}') ) { - if (*(c-1) == '\\') { - p.value[curval][vallen - 1] = *c; - c++; - continue; - } else { - p.value[curval][vallen - 1] = 0; - inval = 0; - c++; - continue; - } - } else { - p.value[curval][vallen] = *c; - vallen++; - c++; - continue; } - } else if (*c == '{') { - if (*(c-1) == '\\') { - p.value[curval][vallen-1] = *c; + while (*c) { + if (*c == '\t') { + c++; + continue; + } + if (inopt) { + // if ((*c < 'a' || *c > 'z') && *c != '_') { + if ((*c < 'a' || *c > 'z') && *c != '_' && (*c < 'A' || *c > 'Z')) { + inopt = 0; + p.option[optlen] = 0; c++; continue; } - else - { - curval++; - vallen = 0; - inval = 1; - c++; - c++; - continue; + + p.option[optlen] = *c; + optlen++; + c++; + continue; + } else if (inval) { + if ((*c == '}')) { + if (*(c - 1) == '\\') { + p.value[curval][vallen - 1] = *c; + c++; + continue; + } else { + p.value[curval][vallen - 1] = 0; + inval = 0; + c++; + continue; + } + } else { + p.value[curval][vallen] = *c; + vallen++; + c++; + continue; } - } - c++; - } + } else if (*c == '{') { + if (*(c - 1) == '\\') { + p.value[curval][vallen - 1] = *c; + c++; + continue; + } else { + curval++; + vallen = 0; + inval = 1; + c++; + c++; + continue; + } + } + c++; + } - return &p; + return &p; } @@ -161,28 +160,26 @@ void filter_break(char *msg) { - char *c; - int mc; + char *c; + int mc; int cc; - - c = g_malloc(strlen(msg)+1); + + c = g_malloc(strlen(msg) + 1); strcpy(c, msg); - mc = 0; + mc = 0; cc = 0; - while (c[cc] != '\0') - { - if (c[cc] == '\\') { - cc++; - msg[mc] = c[cc]; - } - else { - msg[mc] = c[cc]; - } - mc++; - cc++; - } - msg[mc] = 0; + while (c[cc] != '\0') { + if (c[cc] == '\\') { + cc++; + msg[mc] = c[cc]; + } else { + msg[mc] = c[cc]; + } + mc++; + cc++; + } + msg[mc] = 0; g_free(c); } @@ -194,28 +191,25 @@ struct away_message *a; buf[0] = 0; - - while (buf[0] != '}') - { + + while (buf[0] != '}') { if (!fgets(buf, sizeof(buf), f)) return; - + if (buf[0] == '}') return; p = parse_line(buf); - if (!strcmp(p->option, "message")) - { + if (!strcmp(p->option, "message")) { a = g_new0(struct away_message, 1); - g_snprintf(a->name, sizeof(a->name), "%s", p->value[0]); + g_snprintf(a->name, sizeof(a->name), "%s", p->value[0]); g_snprintf(a->message, sizeof(a->message), "%s", p->value[1]); filter_break(a->message); away_messages = g_slist_insert_sorted(away_messages, a, sort_awaymsg_list); } /* auto { time } { default message } */ - else if (!strcmp(p->option, "auto")) - { + else if (!strcmp(p->option, "auto")) { auto_away = atoi(p->value[0]); default_away = atoi(p->value[1]); } @@ -229,8 +223,7 @@ fprintf(f, "away {\n"); - if (awy) - { + if (awy) { while (awy) { char *str1, *str2; @@ -238,19 +231,17 @@ str1 = escape_text2(a->name); str2 = escape_text2(a->message); - + fprintf(f, "\tmessage { %s } { %s }\n", str1, str2); /* escape_text2 uses malloc(), so we don't want to g_free these */ free(str1); free(str2); - + awy = g_slist_next(awy); } fprintf(f, "\tauto { %d } { %d }\n", auto_away, default_away); - } - else - { + } else { fprintf(f, "\tmessage { boring default } { %s }\n", BORING_DEFAULT_AWAY_MSG); fprintf(f, "\tauto { 0 } { 0 }\n"); } @@ -265,21 +256,19 @@ struct buddy_pounce *b; buf[0] = 0; - - while (buf[0] != '}') - { + + while (buf[0] != '}') { if (!fgets(buf, sizeof(buf), f)) return; - + if (buf[0] == '}') return; p = parse_line(buf); - if (!strcmp(p->option, "entry")) - { + if (!strcmp(p->option, "entry")) { b = g_new0(struct buddy_pounce, 1); - g_snprintf(b->name, sizeof(b->name), "%s", p->value[0]); + g_snprintf(b->name, sizeof(b->name), "%s", p->value[0]); g_snprintf(b->message, sizeof(b->message), "%s", p->value[1]); g_snprintf(b->command, sizeof(b->command), "%s", p->value[2]); @@ -321,9 +310,7 @@ } fprintf(f, "\tentry { %s } { %s } { %s } { %d } { %s } { %d }\n", - str1, str2, str3, - b->options, - b->pouncer, b->protocol); + str1, str2, str3, b->options, b->pouncer, b->protocol); /* escape_text2 uses malloc(), so we don't want to g_free these */ free(str1); @@ -343,24 +330,22 @@ struct chat_room *b; buf[0] = 0; - - while (buf[0] != '}') - { + + while (buf[0] != '}') { if (!fgets(buf, sizeof(buf), f)) return; - + if (buf[0] == '}') return; p = parse_line(buf); - if (!strcmp(p->option, "entry")) - { + if (!strcmp(p->option, "entry")) { b = g_new0(struct chat_room, 1); - g_snprintf(b->name, sizeof(b->name), "%s", p->value[0]); + g_snprintf(b->name, sizeof(b->name), "%s", p->value[0]); b->exchange = atoi(p->value[1]); - + chat_rooms = g_list_append(chat_rooms, b); } } @@ -373,8 +358,7 @@ fprintf(f, "chat {\n"); - if (pnc) - { + if (pnc) { while (pnc) { char *str1; @@ -386,7 +370,7 @@ /* escape_text2 uses malloc(), so we don't want to g_free these */ free(str1); - + pnc = pnc->next; } } @@ -426,18 +410,16 @@ GSList *load = NULL; buf[0] = 0; - - while (buf[0] != '}') - { + + while (buf[0] != '}') { if (!fgets(buf, sizeof(buf), f)) break; - + if (buf[0] == '}') break; p = parse_line(buf); - if (!strcmp(p->option, "plugin")) - { + if (!strcmp(p->option, "plugin")) { load = g_slist_append(load, g_strdup(p->value[0])); } } @@ -454,46 +436,46 @@ static struct aim_user *gaimrc_read_user(FILE *f) { - struct parse *p; - struct aim_user *u; + struct parse *p; + struct aim_user *u; int i; - char buf[4096]; + char buf[4096]; - if (!fgets(buf, sizeof(buf), f)) - return NULL; + if (!fgets(buf, sizeof(buf), f)) + return NULL; - p = parse_line(buf); + p = parse_line(buf); - if (strcmp(p->option, "ident")) - return NULL; - - u = g_new0(struct aim_user, 1); + if (strcmp(p->option, "ident")) + return NULL; + + u = g_new0(struct aim_user, 1); - strcpy(u->username, p->value[0]); - strcpy(u->password, p->value[1]); + strcpy(u->username, p->value[0]); + strcpy(u->password, p->value[1]); - u->user_info[0] = 0; + u->user_info[0] = 0; u->options = OPT_USR_REM_PASS; - u->protocol = 0; /* PROTO_TOC */ + u->protocol = 0; /* PROTO_TOC */ - if (!fgets(buf, sizeof(buf), f)) - return u; + if (!fgets(buf, sizeof(buf), f)) + return u; - if (strcmp(buf, "\t\tuser_info {\n")) { - return u; - } + if (strcmp(buf, "\t\tuser_info {\n")) { + return u; + } - if (!fgets(buf, sizeof(buf), f)) - return u; + if (!fgets(buf, sizeof(buf), f)) + return u; - while (strncmp(buf, "\t\t}", 3)) { - if (strlen(buf) > 3) - strcat(u->user_info, &buf[3]); + while (strncmp(buf, "\t\t}", 3)) { + if (strlen(buf) > 3) + strcat(u->user_info, &buf[3]); - if (!fgets(buf, sizeof(buf), f)) { - return u; - } - } + if (!fgets(buf, sizeof(buf), f)) { + return u; + } + } if (!fgets(buf, sizeof(buf), f)) { return u; @@ -525,38 +507,38 @@ for (i = 0; i < 6; i++) g_snprintf(u->proto_opt[i], sizeof u->proto_opt[i], "%s", p->value[i]); - return u; - + return u; + } static void gaimrc_write_user(FILE *f, struct aim_user *u) { - char *c; - int nl = 1, i; + char *c; + int nl = 1, i; if (u->options & OPT_USR_REM_PASS) - fprintf(f, "\t\tident { %s } { %s }\n", u->username, u->password); + fprintf(f, "\t\tident { %s } { %s }\n", u->username, u->password); else fprintf(f, "\t\tident { %s } { }\n", u->username); - fprintf(f, "\t\tuser_info {"); - c = u->user_info; - while(*c) { - /* This is not as silly as it looks. */ - if (*c == '\n') { - nl++; - } else { - if (nl) { - while(nl) { - fprintf(f, "\n\t\t\t"); - nl--; - } - } - fprintf(f, "%c", *c); - } - c++; - } - fprintf(f, "\n\t\t}\n"); + fprintf(f, "\t\tuser_info {"); + c = u->user_info; + while (*c) { + /* This is not as silly as it looks. */ + if (*c == '\n') { + nl++; + } else { + if (nl) { + while (nl) { + fprintf(f, "\n\t\t\t"); + nl--; + } + } + fprintf(f, "%c", *c); + } + c++; + } + fprintf(f, "\n\t\t}\n"); fprintf(f, "\t\tuser_opts { %d } { %d }\n", u->options, u->protocol); - fprintf(f, "\t\tproto_opts"); + fprintf(f, "\t\tproto_opts"); for (i = 0; i < 6; i++) fprintf(f, " { %s }", u->proto_opt[i]); fprintf(f, "\n"); @@ -566,31 +548,31 @@ static void gaimrc_read_users(FILE *f) { char buf[2048]; - struct aim_user *u; - struct parse *p; + struct aim_user *u; + struct parse *p; buf[0] = 0; while (buf[0] != '}') { if (buf[0] == '#') continue; - + if (!fgets(buf, sizeof(buf), f)) return; - - p = parse_line(buf); + + p = parse_line(buf); - if (!strcmp(p->option, "current_user")) { - } else if (strcmp(p->option, "user")) { - continue; - } else { + if (!strcmp(p->option, "current_user")) { + } else if (strcmp(p->option, "user")) { + continue; + } else { } - u = gaimrc_read_user(f); + u = gaimrc_read_user(f); - aim_users = g_list_append(aim_users, u); + aim_users = g_list_append(aim_users, u); } } @@ -600,16 +582,16 @@ struct aim_user *u; fprintf(f, "users {\n"); - - while(usr) { - u = (struct aim_user *)usr->data; - fprintf(f, "\tuser {\n"); - gaimrc_write_user(f, u); - fprintf(f, "\t}\n"); - + while (usr) { + u = (struct aim_user *)usr->data; + fprintf(f, "\tuser {\n"); + gaimrc_write_user(f, u); + + fprintf(f, "\t}\n"); + usr = usr->next; - } + } fprintf(f, "}\n"); } @@ -620,30 +602,30 @@ static void gaimrc_read_options(FILE *f) { char buf[2048]; - struct parse *p; + struct parse *p; - buf[0] = 0; - + 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, "general_options")) { - general_options = atoi(p->value[0]); - } else if (!strcmp(p->option, "display_options")) { - display_options = atoi(p->value[0]); - } else if (!strcmp(p->option, "sound_options")) { - sound_options = atoi(p->value[0]); + p = parse_line(buf); + + if (!strcmp(p->option, "general_options")) { + general_options = atoi(p->value[0]); + } else if (!strcmp(p->option, "display_options")) { + display_options = atoi(p->value[0]); + } else if (!strcmp(p->option, "sound_options")) { + sound_options = atoi(p->value[0]); } else if (!strcmp(p->option, "font_options")) { font_options = atoi(p->value[0]); } else if (!strcmp(p->option, "font_face")) { if (p->value[0] != NULL) - g_snprintf(fontface, sizeof(fontface), "%s", p->value[0]); + g_snprintf(fontface, sizeof(fontface), "%s", p->value[0]); } else if (!strcmp(p->option, "foreground")) { fgcolor.red = atoi(p->value[0]); fgcolor.green = atoi(p->value[1]); @@ -652,22 +634,22 @@ bgcolor.red = atoi(p->value[0]); bgcolor.green = atoi(p->value[1]); bgcolor.blue = atoi(p->value[2]); - } else if (!strcmp(p->option, "report_idle")) { - report_idle = atoi(p->value[0]); - } else if (!strcmp(p->option, "web_browser")) { - web_browser = atoi(p->value[0]); - } else if (!strcmp(p->option, "web_command")) { - strcpy(web_command, p->value[0]); - } else if (!strcmp(p->option, "blist_pos")) { - blist_pos.x = atoi(p->value[0]); - blist_pos.y = atoi(p->value[1]); - blist_pos.width = atoi(p->value[2]); - blist_pos.height = atoi(p->value[3]); - blist_pos.xoff = atoi(p->value[4]); - blist_pos.yoff = atoi(p->value[5]); + } else if (!strcmp(p->option, "report_idle")) { + report_idle = atoi(p->value[0]); + } else if (!strcmp(p->option, "web_browser")) { + web_browser = atoi(p->value[0]); + } else if (!strcmp(p->option, "web_command")) { + strcpy(web_command, p->value[0]); + } else if (!strcmp(p->option, "blist_pos")) { + blist_pos.x = atoi(p->value[0]); + blist_pos.y = atoi(p->value[1]); + blist_pos.width = atoi(p->value[2]); + blist_pos.height = atoi(p->value[3]); + blist_pos.xoff = atoi(p->value[4]); + blist_pos.yoff = atoi(p->value[5]); } - } + } } @@ -675,20 +657,20 @@ { fprintf(f, "options {\n"); - fprintf(f, "\tgeneral_options { %d }\n", general_options); - fprintf(f, "\tdisplay_options { %d }\n", display_options); - fprintf(f, "\tsound_options { %d }\n", sound_options); + fprintf(f, "\tgeneral_options { %d }\n", general_options); + fprintf(f, "\tdisplay_options { %d }\n", display_options); + fprintf(f, "\tsound_options { %d }\n", sound_options); fprintf(f, "\tfont_options { %d }\n", font_options); if (fontface) fprintf(f, "\tfont_face { %s }\n", fontface); fprintf(f, "\tforeground { %d } { %d } { %d }\n", fgcolor.red, fgcolor.green, fgcolor.blue); fprintf(f, "\tbackground { %d } { %d } { %d }\n", bgcolor.red, bgcolor.green, bgcolor.blue); - fprintf(f, "\treport_idle { %d }\n", report_idle); - fprintf(f, "\tweb_browser { %d }\n", web_browser); - fprintf(f, "\tweb_command { %s }\n", web_command); - fprintf(f, "\tblist_pos { %d } { %d } { %d } { %d } { %d } { %d }\n", - blist_pos.x, blist_pos.y, blist_pos.width, blist_pos.height, - blist_pos.xoff, blist_pos.yoff); + fprintf(f, "\treport_idle { %d }\n", report_idle); + fprintf(f, "\tweb_browser { %d }\n", web_browser); + fprintf(f, "\tweb_command { %s }\n", web_command); + fprintf(f, "\tblist_pos { %d } { %d } { %d } { %d } { %d } { %d }\n", + blist_pos.x, blist_pos.y, blist_pos.width, blist_pos.height, + blist_pos.xoff, blist_pos.yoff); fprintf(f, "}\n"); } @@ -697,29 +679,29 @@ { int i; char buf[2048]; - struct parse *p; + struct parse *p; - buf[0] = 0; + buf[0] = 0; for (i = 0; i < NUM_SOUNDS; i++) sound_file[i] = NULL; sound_cmd[0] = 0; - + while (buf[0] != '}') { if (buf[0] == '#') continue; - + if (!fgets(buf, sizeof(buf), f)) return; - p = parse_line(buf); - + p = parse_line(buf); + if (!strcmp(p->option, "sound_cmd")) { g_snprintf(sound_cmd, sizeof(sound_cmd), "%s", p->value[0]); } else if (!strncmp(p->option, "sound", strlen("sound"))) { sscanf(p->option, "sound%c", (char *)&i); i -= 'A'; - + if (p->value[0][0]) sound_file[i] = g_strdup(p->value[0]); } @@ -742,64 +724,62 @@ void set_defaults(int saveinfo) { - if (!saveinfo) - { - if (aim_users) - { - g_list_free(aim_users); - aim_users = NULL; - } - if (away_messages) - { - g_slist_free(away_messages); - away_messages = NULL; - } + if (!saveinfo) { + if (aim_users) { + g_list_free(aim_users); + aim_users = NULL; + } + if (away_messages) { + g_slist_free(away_messages); + away_messages = NULL; + } } - general_options = - OPT_GEN_SEND_LINKS | - OPT_GEN_ENTER_SENDS | - OPT_GEN_SAVED_WINDOWS | - /* OPT_GEN_REMEMBER_PASS | */ - OPT_GEN_REGISTERED | - OPT_GEN_NEAR_APPLET | - OPT_GEN_CTL_SMILEYS | - OPT_GEN_CTL_CHARS; + general_options = + OPT_GEN_SEND_LINKS | + OPT_GEN_ENTER_SENDS | + OPT_GEN_SAVED_WINDOWS | + /* OPT_GEN_REMEMBER_PASS | */ + OPT_GEN_REGISTERED | + OPT_GEN_NEAR_APPLET | + OPT_GEN_CTL_SMILEYS | + OPT_GEN_CTL_CHARS; - display_options = - OPT_DISP_SHOW_IDLETIME | - OPT_DISP_SHOW_TIME | - OPT_DISP_SHOW_PIXMAPS | - OPT_DISP_SHOW_BUDDYTICKER | - OPT_DISP_SHOW_BUTTON_XPM | - OPT_DISP_SHOW_SMILEY | - OPT_DISP_COOL_LOOK | - OPT_DISP_CONV_BIG_ENTRY | - OPT_DISP_CHAT_BIG_ENTRY | - OPT_DISP_CONV_BUTTON_XPM | - OPT_DISP_CONV_BUTTON_TEXT | - OPT_DISP_CHAT_BUTTON_XPM | - OPT_DISP_CHAT_BUTTON_TEXT; + display_options = + OPT_DISP_SHOW_IDLETIME | + OPT_DISP_SHOW_TIME | + OPT_DISP_SHOW_PIXMAPS | + OPT_DISP_SHOW_BUDDYTICKER | + OPT_DISP_SHOW_BUTTON_XPM | + OPT_DISP_SHOW_SMILEY | + OPT_DISP_COOL_LOOK | + OPT_DISP_CONV_BIG_ENTRY | + OPT_DISP_CONV_BUTTON_XPM | + OPT_DISP_CHAT_BUTTON_TEXT; - if (!saveinfo) - { + if (!saveinfo) { int i; for (i = 0; i < 7; i++) sound_file[i] = NULL; - font_options = 0; - sound_options = OPT_SOUND_LOGIN | OPT_SOUND_LOGOUT | OPT_SOUND_RECV | OPT_SOUND_SEND | OPT_SOUND_SILENT_SIGNON; - report_idle = IDLE_SCREENSAVER; - web_browser = BROWSER_NETSCAPE; + font_options = 0; + sound_options = + OPT_SOUND_LOGIN | + OPT_SOUND_LOGOUT | + OPT_SOUND_RECV | + OPT_SOUND_SEND | + OPT_SOUND_SILENT_SIGNON; + report_idle = IDLE_SCREENSAVER; + web_browser = BROWSER_NETSCAPE; auto_away = 10; default_away = 0; - - g_snprintf(web_command, sizeof(web_command), "xterm -e lynx %%s"); - blist_pos.width = 0; - blist_pos.height = 0; - blist_pos.x = 0; - blist_pos.y = 0; - blist_pos.xoff = 0; - blist_pos.yoff = 0; + + g_snprintf(web_command, sizeof(web_command), "xterm -e lynx %%s"); + blist_pos.width = 0; + blist_pos.height = 0; + blist_pos.x = 0; + blist_pos.y = 0; + blist_pos.xoff = 0; + blist_pos.yoff = 0; } } @@ -810,33 +790,33 @@ char buf[1024]; int ver = 0; - if (getenv("HOME")) { - g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME")); - if ((f = fopen(buf,"r"))) { + if (getenv("HOME")) { + g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME")); + if ((f = fopen(buf, "r"))) { fgets(buf, sizeof(buf), f); sscanf(buf, "# .gaimrc v%d", &ver); - if ( (ver <= 1) || (buf[0] != '#')) { - fclose(f); + if ((ver <= 1) || (buf[0] != '#')) { + fclose(f); set_defaults(FALSE); save_prefs(); load_prefs(); - return; + return; } - - while(!feof(f)) { - switch(gaimrc_parse_tag(f)) { + + while (!feof(f)) { + switch (gaimrc_parse_tag(f)) { case -1: - /* Let the loop end, EOF*/ + /* Let the loop end, EOF */ break; case 0: gaimrc_read_users(f); break; case 1: gaimrc_read_options(f); - break; - case 2: - gaimrc_read_away(f); - break; + break; + case 2: + gaimrc_read_away(f); + break; #ifdef GAIM_PLUGINS case 3: gaimrc_read_plugins(f); @@ -860,7 +840,7 @@ } } - if ( (ver == 2) || (buf[0] != '#')) { + if ((ver == 2) || (buf[0] != '#')) { set_defaults(TRUE); } } @@ -872,7 +852,7 @@ if (getenv("HOME")) { g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME")); - if ((f = fopen(buf,"w"))) { + if ((f = fopen(buf, "w"))) { fprintf(f, "# .gaimrc v%d\n", 4); gaimrc_write_users(f); gaimrc_write_options(f); @@ -897,12 +877,12 @@ gint sort_awaymsg_list(gconstpointer a, gconstpointer b) { - struct away_message *msg_a; - struct away_message *msg_b; - - msg_a = (struct away_message *)a; - msg_b = (struct away_message *)b; - - return (strcmp(msg_a->name, msg_b->name)); - + struct away_message *msg_a; + struct away_message *msg_b; + + msg_a = (struct away_message *)a; + msg_b = (struct away_message *)b; + + return (strcmp(msg_a->name, msg_b->name)); + }
--- a/src/gtkhtml.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/gtkhtml.c Wed Dec 13 20:18:35 2000 +0000 @@ -3655,7 +3655,7 @@ else if (*(c + 1) == '#') { int pound = 0; - debug_print("got &#;\n"); + debug_printf("got &#;\n"); if (sscanf(c, "&#%d;", £) > 0) { ws[wpos++] = (char)pound; c += 2;
--- a/src/html.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/html.c Wed Dec 13 20:18:35 2000 +0000 @@ -39,27 +39,22 @@ #include <errno.h> #include "proxy.h" -gchar * strip_html(gchar * text) +gchar *strip_html(gchar *text) { int i, j; int visible = 1; gchar *text2 = g_malloc(strlen(text) + 1); - + strcpy(text2, text); - for (i = 0, j = 0;text2[i]; i++) - { - if(text2[i]=='<') - { + for (i = 0, j = 0; text2[i]; i++) { + if (text2[i] == '<') { visible = 0; continue; - } - else if(text2[i]=='>') - { + } else if (text2[i] == '>') { visible = 1; continue; } - if(visible) - { + if (visible) { text2[j++] = text2[i]; } } @@ -75,24 +70,28 @@ int f; if (strstr(url, "http://")) - g_snprintf(scan_info, sizeof(scan_info), "http://%%[A-Za-z0-9.]:%%[0-9]/%%[A-Za-z0-9.~_-/&%%?]"); + g_snprintf(scan_info, sizeof(scan_info), + "http://%%[A-Za-z0-9.]:%%[0-9]/%%[A-Za-z0-9.~_-/&%%?]"); else - g_snprintf(scan_info, sizeof(scan_info), "%%[A-Za-z0-9.]:%%[0-9]/%%[A-Za-z0-9.~_-/&%%?]"); + g_snprintf(scan_info, sizeof(scan_info), + "%%[A-Za-z0-9.]:%%[0-9]/%%[A-Za-z0-9.~_-/&%%?]"); f = sscanf(url, scan_info, test.address, port, test.page); if (f == 1) { if (strstr(url, "http://")) - g_snprintf(scan_info, sizeof(scan_info), "http://%%[A-Za-z0-9.]/%%[A-Za-z0-9.~_-/&%%?]"); + g_snprintf(scan_info, sizeof(scan_info), + "http://%%[A-Za-z0-9.]/%%[A-Za-z0-9.~_-/&%%?]"); else - g_snprintf(scan_info, sizeof(scan_info), "%%[A-Za-z0-9.]/%%[A-Za-z0-9.~_-/&%%?]"); - f = sscanf(url, scan_info, test.address, test.page); - g_snprintf(port, sizeof(test.port), "80"); - port[2] = 0; + g_snprintf(scan_info, sizeof(scan_info), + "%%[A-Za-z0-9.]/%%[A-Za-z0-9.~_-/&%%?]"); + f = sscanf(url, scan_info, test.address, test.page); + g_snprintf(port, sizeof(test.port), "80"); + port[2] = 0; } if (f == 1) { if (strstr(url, "http://")) g_snprintf(scan_info, sizeof(scan_info), "http://%%[A-Za-z0-9.]"); - else - g_snprintf(scan_info, sizeof(scan_info), "%%[A-Za-z0-9.]"); + else + g_snprintf(scan_info, sizeof(scan_info), "%%[A-Za-z0-9.]"); f = sscanf(url, scan_info, test.address); g_snprintf(test.page, sizeof(test.page), "%c", '\0'); } @@ -105,20 +104,20 @@ { struct g_url website; char *webdata = NULL; - int sock; - int len; + int sock; + int len; int read_rv; int datalen = 0; char buf[256]; char data; - int startsaving = 0; - GtkWidget *pw = NULL, *pbar = NULL, *label; + int startsaving = 0; + GtkWidget *pw = NULL, *pbar = NULL, *label; - website = parse_url(url); + website = parse_url(url); if (user) { if ((sock = proxy_connect(website.address, website.port, user->proto_opt[2], - atoi(user->proto_opt[3]), atoi(user->proto_opt[4]))) < 0) + atoi(user->proto_opt[3]), atoi(user->proto_opt[4]))) < 0) return g_strdup(_("g003: Error opening connection.\n")); } else { if ((sock = proxy_connect(website.address, website.port, NULL, 0, -1)) < 0) @@ -126,18 +125,17 @@ } g_snprintf(buf, sizeof(buf), "GET /%s HTTP/1.0\r\n\r\n", website.page); - g_snprintf(debug_buff, sizeof(debug_buff), "Request: %s\n", buf); - debug_print(debug_buff); + debug_printf("Request: %s\n", buf); write(sock, buf, strlen(buf)); fcntl(sock, F_SETFL, O_NONBLOCK); - webdata = NULL; - len = 0; - + webdata = NULL; + len = 0; + /* * avoid fgetc(), it causes problems on solaris - while ((data = fgetc(sockfile)) != EOF) { - */ + while ((data = fgetc(sockfile)) != EOF) { + */ /* read_rv will be 0 on EOF and < 0 on error, so this should be fine */ while ((read_rv = read(sock, &data, 1)) > 0 || errno == EWOULDBLOCK) { if (errno == EWOULDBLOCK) { @@ -147,7 +145,7 @@ if (!data) continue; - + if (!startsaving && data == '<') { #ifdef HAVE_STRSTR char *cs = strstr(webdata, "Content-Length"); @@ -155,26 +153,26 @@ char tmpbuf[1024]; sscanf(cs, "Content-Length: %d", &datalen); - g_snprintf(tmpbuf, 1024, _("Getting %d bytes from %s"), datalen, url); - pw = gtk_dialog_new(); + g_snprintf(tmpbuf, 1024, _("Getting %d bytes from %s"), datalen, url); + pw = gtk_dialog_new(); label = gtk_label_new(tmpbuf); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(pw)->vbox), label, FALSE, FALSE, 5); - + pbar = gtk_progress_bar_new(); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(pw)->action_area), pbar, FALSE, FALSE, 5); - gtk_widget_show(pbar); - - gtk_window_set_title(GTK_WINDOW(pw), _("Getting Data")); - - gtk_widget_realize(pw); - aol_icon(pw->window); + gtk_widget_show(pbar); + + gtk_window_set_title(GTK_WINDOW(pw), _("Getting Data")); - gtk_widget_show(pw); - } else + gtk_widget_realize(pw); + aol_icon(pw->window); + + gtk_widget_show(pw); + } else datalen = 0; #else datalen = 0; @@ -190,22 +188,20 @@ webdata[len - 1] = data; if (pbar) - gtk_progress_bar_update(GTK_PROGRESS_BAR(pbar), - ((100 * len) / datalen) / 100.0); - + gtk_progress_bar_update(GTK_PROGRESS_BAR(pbar), ((100 * len) / datalen) / 100.0); + while (gtk_events_pending()) gtk_main_iteration(); } - webdata = g_realloc(webdata, len+1); - webdata[len] = 0; + webdata = g_realloc(webdata, len + 1); + webdata[len] = 0; - g_snprintf(debug_buff, sizeof(debug_buff), _("Receieved: '%s'\n"), webdata); - debug_print(debug_buff); + debug_printf(_("Receieved: '%s'\n"), webdata); - if (pw) - gtk_widget_destroy(pw); + if (pw) + gtk_widget_destroy(pw); close(sock); return webdata;
--- a/src/idle.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/idle.c Wed Dec 13 20:18:35 2000 +0000 @@ -48,11 +48,11 @@ #endif time_t idle_time; - /* Not idle, really... :) */ + /* Not idle, really... :) */ update_idle_times(); plugin_event(event_blist_update, 0, 0, 0, 0); - + time(&t); @@ -61,27 +61,25 @@ if (!d) d = XOpenDisplay((char *)NULL); if (mit_info == NULL) { - mit_info = XScreenSaverAllocInfo (); + mit_info = XScreenSaverAllocInfo(); } - XScreenSaverQueryInfo (d, DefaultRootWindow(d), mit_info); - idle_time = (mit_info->idle)/1000; + XScreenSaverQueryInfo(d, DefaultRootWindow(d), mit_info); + idle_time = (mit_info->idle) / 1000; } else #endif /* USE_SCREENSAVER */ idle_time = t - gc->lastsent; - if ((general_options & OPT_GEN_AUTO_AWAY) && - (idle_time > (60 * auto_away)) && - (awaymessage == NULL) && - (auto_is_away == 0)) { + if ((general_options & OPT_GEN_AUTO_AWAY) && + (idle_time > (60 * auto_away)) && (awaymessage == NULL) && (auto_is_away == 0)) { struct away_message *a; - set_default_away((GtkWidget*)NULL, (gpointer)default_away); + set_default_away((GtkWidget *)NULL, (gpointer)default_away); a = g_slist_nth_data(away_messages, default_away); - do_away_message((GtkWidget*)NULL, a); + do_away_message((GtkWidget *)NULL, a); auto_is_away = 1; - } else if (auto_is_away == 1 && idle_time < 60*auto_away) { + } else if (auto_is_away == 1 && idle_time < 60 * auto_away) { auto_is_away = 0; if (awaymessage != NULL) - do_im_back((GtkWidget*)NULL, (GtkWidget*)NULL); + do_im_back((GtkWidget *)NULL, (GtkWidget *)NULL); } @@ -92,11 +90,11 @@ return TRUE; } - if (idle_time > 600 && !gc->is_idle) { /* 10 minutes! */ + if (idle_time > 600 && !gc->is_idle) { /* 10 minutes! */ debug_printf("setting %s idle %d seconds\n", gc->username, idle_time); serv_set_idle(gc, idle_time); gc->is_idle = 1; - } else if (idle_time < 600 && gc->is_idle) { + } else if (idle_time < 600 && gc->is_idle) { debug_printf("setting %s unidle\n", gc->username); serv_touch_idle(gc); }
--- a/src/multi.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/multi.c Wed Dec 13 20:18:35 2000 +0000 @@ -38,11 +38,13 @@ GSList *connections; static GtkWidget *acctedit = NULL; -static GtkWidget *list = NULL; /* the clist of names in the accteditor */ -static GtkWidget *newmod = NULL; /* the dialog for creating a new account */ -static GtkWidget *newmain = NULL; /* the frame that holds the possible notebook for options */ +static GtkWidget *list = NULL; /* the clist of names in the accteditor */ +static GtkWidget *newmod = NULL; /* the dialog for creating a new account */ +static GtkWidget *newmain = NULL; /* the notebook that holds options */ static struct aim_user tmpusr; +static void generate_prpl_options(struct aim_user *, GtkWidget *); + struct mod_usr_opt { struct aim_user *user; int opt; @@ -97,7 +99,8 @@ #endif } -struct gaim_connection *find_gaim_conn_by_name(char *name) { +struct gaim_connection *find_gaim_conn_by_name(char *name) +{ char *who = g_strdup(normalize(name)); GSList *c = connections; struct gaim_connection *g = NULL; @@ -146,14 +149,14 @@ static GtkWidget *generate_list() { GtkWidget *win; - char *titles[4] = {"Screenname", "Currently Online", "Auto-login", "Protocol"}; + char *titles[4] = { "Screenname", "Currently Online", "Auto-login", "Protocol" }; GList *u = aim_users; struct aim_user *a; int i; win = gtk_scrolled_window_new(0, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(win), GTK_POLICY_AUTOMATIC, - GTK_POLICY_ALWAYS); + GTK_POLICY_ALWAYS); list = gtk_clist_new_with_titles(4, titles); gtk_clist_set_column_width(GTK_CLIST(list), 0, 90); @@ -196,7 +199,8 @@ } } -static void free_muo(GtkWidget *b, struct mod_usr_opt *m) { +static void free_muo(GtkWidget *b, struct mod_usr_opt *m) +{ g_free(m); } @@ -211,7 +215,8 @@ gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (tmpusr.options & option)); } gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); - muo->user = u; muo->opt = option; + muo->user = u; + muo->opt = option; gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_opt), muo); gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo); gtk_widget_show(button); @@ -232,7 +237,8 @@ u->password[0] = '\0'; gtk_widget_destroy(u->mod); i = gtk_clist_find_row_from_data(GTK_CLIST(list), u); - gtk_clist_set_text(GTK_CLIST(list), i, 2, (u->options & OPT_USR_AUTO) ? "True" : "False"); + 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)); } else { char *titles[4]; @@ -267,8 +273,6 @@ } } -static void generate_options(struct aim_user *, GtkWidget *); - static void set_prot(GtkWidget *opt, int proto) { struct aim_user *u = gtk_object_get_user_data(GTK_OBJECT(opt)); @@ -277,17 +281,17 @@ for (i = 0; i < 6; i++) u->proto_opt[i][0] = '\0'; u->tmp_protocol = proto; - generate_options(u, u->main); + generate_prpl_options(u, u->main); } else if (tmpusr.tmp_protocol != proto) { int i; for (i = 0; i < 6; i++) tmpusr.proto_opt[i][0] = '\0'; tmpusr.tmp_protocol = tmpusr.protocol = proto; - generate_options(NULL, newmain); + generate_prpl_options(NULL, newmain); } } -static GtkWidget *make_protocol_menu(GtkWidget *box, struct aim_user *u, GtkWidget *frame) +static GtkWidget *make_protocol_menu(GtkWidget *box, struct aim_user *u) { GtkWidget *optmenu; GtkWidget *menu; @@ -334,97 +338,45 @@ return optmenu; } -static void generate_options(struct aim_user *u, GtkWidget *frame) { - GList *tmp; - GtkWidget *book; +static void generate_general_options(struct aim_user *u, GtkWidget *book) +{ GtkWidget *vbox; GtkWidget *hbox; GtkWidget *label; GtkWidget *name; GtkWidget *pass; - struct prpl *p; - tmp = gtk_container_children(GTK_CONTAINER(frame)); - - if (u) - p = find_prpl(u->tmp_protocol); - else - p = find_prpl(tmpusr.protocol); + 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(_("General Options"))); - if (p && p->user_opts) { - if (tmp && !GTK_IS_NOTEBOOK(tmp->data)) { - gtk_widget_destroy(tmp->data); - tmp = NULL; - } - - if (!tmp) { - book = gtk_notebook_new(); - gtk_container_add(GTK_CONTAINER(frame), book); - gtk_widget_show(book); + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - vbox = gtk_vbox_new(FALSE, 0); - gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, - gtk_label_new(_("General Options"))); - gtk_widget_show(vbox); + label = gtk_label_new(_("Screenname:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - if (u) - (*p->user_opts)(book, u); - else - (*p->user_opts)(book, &tmpusr); - } else { - book = (GtkWidget *)tmp->data; - gtk_notebook_remove_page(GTK_NOTEBOOK(book), 1); - if (u) - (*p->user_opts)(book, u); - else - (*p->user_opts)(book, &tmpusr); - return; - } - } else { - if (tmp && GTK_IS_NOTEBOOK(tmp->data)) { - gtk_widget_destroy(tmp->data); - tmp = NULL; - } + name = gtk_entry_new(); + gtk_box_pack_start(GTK_BOX(hbox), name, TRUE, TRUE, 0); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - if (!tmp) { - vbox = gtk_vbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(frame), vbox); - gtk_widget_show(vbox); - } else { - return; - } - } + label = gtk_label_new(_("Password:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - hbox = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); + pass = gtk_entry_new(); + gtk_box_pack_start(GTK_BOX(hbox), pass, TRUE, TRUE, 0); + gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); + + 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(_("Screenname:")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - name = gtk_entry_new(); - gtk_box_pack_start(GTK_BOX(hbox), name, FALSE, FALSE, 5); - gtk_widget_show(name); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); + label = gtk_label_new(_("Protocol:")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - label = gtk_label_new(_("Password:")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - pass = gtk_entry_new(); - gtk_box_pack_start(GTK_BOX(hbox), pass, FALSE, FALSE, 5); - gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); - gtk_widget_show(pass); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); - - make_protocol_menu(hbox, u, frame); + make_protocol_menu(hbox, u); acct_button(_("Remember Password"), u, OPT_USR_REM_PASS, vbox); acct_button(_("Auto-Login"), u, OPT_USR_AUTO, vbox); @@ -440,6 +392,30 @@ tmpusr.name = name; tmpusr.pass = pass; } + + gtk_widget_show_all(vbox); +} + +static void generate_prpl_options(struct aim_user *u, GtkWidget *book) +{ + struct prpl *p; + + if (u) + p = find_prpl(u->tmp_protocol); + else + p = find_prpl(tmpusr.protocol); + + /* page 0 is general, keep it. page 1 is options for our + * particular protocol, so clear it out and make a new one. */ + + 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); + } } static void show_acct_mod(struct aim_user *u) @@ -452,7 +428,7 @@ * to use. make sure to account for the possibility of protocol plugins. */ GtkWidget *mod; GtkWidget *box; - GtkWidget *frame; + GtkWidget *book; GtkWidget *hbox; GtkWidget *button; @@ -469,48 +445,45 @@ gtk_window_set_wmclass(GTK_WINDOW(mod), "account", "Gaim"); gtk_widget_realize(mod); aol_icon(mod->window); - gtk_container_border_width(GTK_CONTAINER(mod), 10); gtk_window_set_title(GTK_WINDOW(mod), _("Gaim - Modify Account")); - gtk_window_set_policy(GTK_WINDOW(mod), 0, 1, 1); /* i know, i'm odd */ - gtk_signal_connect(GTK_OBJECT(mod), "destroy", - GTK_SIGNAL_FUNC(delmod), u); + gtk_window_set_policy(GTK_WINDOW(mod), FALSE, TRUE, TRUE); /* nothing odd here :) */ + gtk_signal_connect(GTK_OBJECT(mod), "destroy", GTK_SIGNAL_FUNC(delmod), u); - box = gtk_vbox_new(FALSE, 0); + box = gtk_vbox_new(FALSE, 5); + gtk_container_border_width(GTK_CONTAINER(mod), 5); gtk_container_add(GTK_CONTAINER(mod), box); - gtk_widget_show(box); + + book = gtk_notebook_new(); + gtk_box_pack_start(GTK_BOX(box), book, FALSE, FALSE, 0); - frame = gtk_frame_new(_("Modify Account")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - if (u) u->tmp_protocol = u->protocol; - else tmpusr.tmp_protocol = tmpusr.protocol; - generate_options(u, frame); + if (u) + u->tmp_protocol = u->protocol; + else + tmpusr.tmp_protocol = tmpusr.protocol; + generate_general_options(u, book); + generate_prpl_options(u, book); hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); + gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); button = picture_button(mod, _("Cancel"), cancel_xpm); - gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); + gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(cancel_mod), u); - gtk_widget_show(button); button = picture_button(mod, _("OK"), ok_xpm); - gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); + gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(ok_mod), u); - gtk_widget_show(button); if (u) { u->mod = mod; - u->main = frame; /* ha, get it? :) */ + u->main = book; /* sorry, i think i broke the joke :) */ u->tmp_options = u->options; } else { newmod = mod; - newmain = frame; + newmain = book; } - gtk_widget_show(mod); + gtk_widget_show_all(mod); } static void add_acct(GtkWidget *w, gpointer d) @@ -565,7 +538,10 @@ GtkWidget *label; GtkWidget *button; - if (u->passprmt) { gtk_widget_show(u->passprmt); return; } + if (u->passprmt) { + gtk_widget_show(u->passprmt); + return; + } u->passprmt = gtk_window_new(GTK_WINDOW_DIALOG); gtk_window_set_wmclass(GTK_WINDOW(u->passprmt), "password", "Gaim"); gtk_container_border_width(GTK_CONTAINER(u->passprmt), 5); @@ -635,7 +611,7 @@ } } } - + static void del_acct(GtkWidget *w, gpointer d) { int row = -1; @@ -657,60 +633,55 @@ void account_editor(GtkWidget *w, GtkWidget *W) { /* please kill me */ - GtkWidget *frame; - GtkWidget *box; - GtkWidget *list; + GtkWidget *vbox; GtkWidget *hbox; - GtkWidget *button; /* used for many things */ + GtkWidget *list; + GtkWidget *button; /* used for many things */ - if (acctedit) { gtk_widget_show(acctedit); return; } + if (acctedit) { + gtk_widget_show(acctedit); + return; + } acctedit = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(acctedit), _("Gaim - Account Editor")); gtk_window_set_wmclass(GTK_WINDOW(acctedit), "accounteditor", "Gaim"); gtk_widget_realize(acctedit); aol_icon(acctedit->window); - gtk_container_border_width(GTK_CONTAINER(acctedit), 10); gtk_widget_set_usize(acctedit, -1, 200); - gtk_signal_connect(GTK_OBJECT(acctedit), "destroy", - GTK_SIGNAL_FUNC(delete_acctedit), W); + gtk_signal_connect(GTK_OBJECT(acctedit), "destroy", GTK_SIGNAL_FUNC(delete_acctedit), W); - frame = gtk_frame_new(_("Account Editor")); - gtk_container_add(GTK_CONTAINER(acctedit), frame); - gtk_widget_show(frame); - - box = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), box); - gtk_widget_show(box); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); + gtk_container_add(GTK_CONTAINER(acctedit), vbox); list = generate_list(); - gtk_box_pack_start(GTK_BOX(box), list, TRUE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(vbox), list, TRUE, TRUE, 0); hbox = gtk_hbox_new(TRUE, 5); - gtk_box_pack_end(GTK_BOX(box), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); + gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); button = picture_button(acctedit, _("Add"), gnome_add_xpm); - gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(add_acct), NULL); button = picture_button(acctedit, _("Modify"), gnome_preferences_xpm); - gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_acct), NULL); button = picture_button(acctedit, _("Sign On/Off"), join_xpm); - gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acct_signin), NULL); button = picture_button(acctedit, _("Delete"), gnome_remove_xpm); - gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(del_acct), NULL); button = picture_button(acctedit, _("Close"), gnome_close_xpm); - gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 0); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(acctedit_close), W); - gtk_widget_show(acctedit); + gtk_widget_show_all(acctedit); } void account_online(struct gaim_connection *gc) @@ -721,12 +692,12 @@ if (gc->meter) gtk_widget_destroy(gc->meter); gc->meter = NULL; - + /* then we do the buddy list stuff */ if (mainwindow) gtk_widget_hide(mainwindow); show_buddy_list(); - + #ifdef USE_APPLET if (general_options & OPT_GEN_APP_BUDDY_SHOW) { refresh_buddy_window(); @@ -749,7 +720,8 @@ plugin_event(event_signon, gc, 0, 0, 0); /* everything for the account editor */ - if (!acctedit) return; + if (!acctedit) + return; i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); gtk_clist_set_text(GTK_CLIST(list), i, 1, "Yes"); gtk_clist_set_text(GTK_CLIST(list), i, 3, proto_name(gc->protocol)); @@ -763,8 +735,9 @@ if (gc->meter) gtk_widget_destroy(gc->meter); gc->meter = NULL; - gc->user->gc = NULL; /* wasn't that awkward? */ - if (!acctedit) return; + gc->user->gc = NULL; /* wasn't that awkward? */ + if (!acctedit) + return; i = gtk_clist_find_row_from_data(GTK_CLIST(list), gc->user); gtk_clist_set_text(GTK_CLIST(list), i, 1, "No"); redo_convo_menus(); @@ -787,15 +760,18 @@ } } -static void cancel_signon(GtkWidget *button, struct gaim_connection *gc) { +static void cancel_signon(GtkWidget *button, struct gaim_connection *gc) +{ signoff(gc); } -static gint meter_destroy(GtkWidget *meter, GdkEvent *evt, struct gaim_connection *gc) { +static gint meter_destroy(GtkWidget *meter, GdkEvent *evt, struct gaim_connection *gc) +{ return TRUE; } -void set_login_progress(struct gaim_connection *gc, float howfar, char *message) { +void set_login_progress(struct gaim_connection *gc, float howfar, char *message) +{ if (mainwindow) gtk_widget_hide(mainwindow);
--- a/src/oscar.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/oscar.c Wed Dec 13 20:18:35 2000 +0000 @@ -292,7 +292,7 @@ if (!g_slist_find(connections, gc)) { /* oh boy. this is probably bad. i guess the only thing we can really do * is return? */ - debug_print("oscar callback for closed connection.\n"); + debug_printf("oscar callback for closed connection.\n"); return; } @@ -303,9 +303,9 @@ } if (condition & GDK_INPUT_READ) { if (conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) { - debug_print("got information on rendezvous\n"); + debug_printf("got information on rendezvous\n"); if (aim_handlerendconnect(odata->sess, conn) < 0) { - debug_print(_("connection error (rend)\n")); + debug_printf(_("connection error (rend)\n")); } } else { if (aim_get_command(odata->sess, conn) >= 0) { @@ -313,14 +313,13 @@ } else { if ((conn->type == AIM_CONN_TYPE_BOS) || !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) { - debug_print(_("major connection error\n")); + debug_printf(_("major connection error\n")); hide_login_progress(gc, _("Disconnected.")); signoff(gc); } else if (conn->type == AIM_CONN_TYPE_CHAT) { struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); char buf[BUF_LONG]; - sprintf(debug_buff, "disconnected from chat room %s\n", c->name); - debug_print(debug_buff); + debug_printf("disconnected from chat room %s\n", c->name); c->conn = NULL; if (c->inpa > -1) gdk_input_remove(c->inpa); @@ -333,16 +332,15 @@ if (odata->cnpa > -1) gdk_input_remove(odata->cnpa); odata->cnpa = -1; - debug_print("removing chatnav input watcher\n"); + debug_printf("removing chatnav input watcher\n"); aim_conn_kill(odata->sess, &conn); } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { debug_printf("No handler for rendezvous disconnect (%d).\n", source); aim_conn_kill(odata->sess, &conn); } else { - sprintf(debug_buff, "holy crap! generic connection error! %d\n", + debug_printf("holy crap! generic connection error! %d\n", conn->type); - debug_print(debug_buff); aim_conn_kill(odata->sess, &conn); } } @@ -359,8 +357,7 @@ struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); odata->create_exchange = 0; - sprintf(debug_buff, _("Logging in %s\n"), user->username); - debug_print(debug_buff); + debug_printf(_("Logging in %s\n"), user->username); sess = g_new0(struct aim_session_t, 1); @@ -396,19 +393,19 @@ g_free(finalauth); if (conn == NULL) { - debug_print(_("internal connection error\n")); + debug_printf(_("internal connection error\n")); hide_login_progress(gc, _("Unable to login to AIM")); signoff(gc); return; } else if (conn->fd == -1) { if (conn->status & AIM_CONN_STATUS_RESOLVERR) { - sprintf(debug_buff, _("couldn't resolve host")); - debug_print(debug_buff); debug_print("\n"); - hide_login_progress(gc, debug_buff); + char *crh = _("couldn't resolve host"); + debug_printf("%s\n", crh); + hide_login_progress(gc, crh); } else if (conn->status & AIM_CONN_STATUS_CONNERR) { - sprintf(debug_buff, _("couldn't connect to host")); - debug_print(debug_buff); debug_print("\n"); - hide_login_progress(gc, debug_buff); + char *cch = _("couldn't connect to host"); + debug_printf("%s\n", cch); + hide_login_progress(gc, cch); } signoff(gc); return; @@ -423,7 +420,7 @@ gc->inpa = gdk_input_add(conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, oscar_callback, conn); - debug_print(_("Password sent, waiting for response\n")); + debug_printf(_("Password sent, waiting for response\n")); } void oscar_close(struct gaim_connection *gc) { @@ -448,7 +445,7 @@ aim_logoff(odata->sess); g_free(odata->sess); g_free(gc->proto_data); - debug_print(_("Signed off.\n")); + debug_printf(_("Signed off.\n")); } int gaim_parse_auth_resp(struct aim_session_t *sess, @@ -486,8 +483,7 @@ va_end(ap); - sprintf(debug_buff, "inside auth_resp (Screen name: %s)\n", sn); - debug_print(debug_buff); + debug_printf("inside auth_resp (Screen name: %s)\n", sn); if (errorcode || !bosip || !cookie) { switch (errorcode) { @@ -608,10 +604,10 @@ case AIM_CONN_TYPE_BOS: aim_setversions(sess, command->conn); aim_bos_reqrate(sess, command->conn); /* request rate info */ - debug_print("done with BOS ServerReady\n"); + debug_printf("done with BOS ServerReady\n"); break; case AIM_CONN_TYPE_CHATNAV: - debug_print("chatnav: got server ready\n"); + debug_printf("chatnav: got server ready\n"); aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); aim_bos_reqrate(sess, command->conn); aim_bos_ackrateresp(sess, command->conn); @@ -619,7 +615,7 @@ aim_chatnav_reqrights(sess, command->conn); break; case AIM_CONN_TYPE_CHAT: - debug_print("chat: got server ready\n"); + debug_printf("chat: got server ready\n"); aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_chat_join, 0); aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_chat_leave, 0); aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_chat_info_update, 0); @@ -634,8 +630,7 @@ case AIM_CONN_TYPE_RENDEZVOUS: break; default: /* huh? */ - sprintf(debug_buff, "server ready: got unexpected connection type %04x\n", command->conn->type); - debug_print(debug_buff); + debug_printf("server ready: got unexpected connection type %04x\n", command->conn->type); break; } return 1; @@ -657,11 +652,11 @@ switch(serviceid) { case 0x7: /* Authorizer */ - debug_print("Reconnecting with authorizor...\n"); + debug_printf("Reconnecting with authorizor...\n"); { struct aim_conn_t *tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, ip); if (tstconn == NULL || tstconn->status & AIM_CONN_STATUS_RESOLVERR) - debug_print("unable to reconnect with authorizer\n"); + debug_printf("unable to reconnect with authorizer\n"); else { odata->paspa = gdk_input_add(tstconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, @@ -674,7 +669,7 @@ { struct aim_conn_t *tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, ip); if (tstconn == NULL || tstconn->status & AIM_CONN_STATUS_RESOLVERR) { - debug_print("unable to connect to chatnav server\n"); + debug_printf("unable to connect to chatnav server\n"); return 1; } aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, gaim_server_ready, 0); @@ -682,7 +677,7 @@ odata->cnpa = gdk_input_add(tstconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, oscar_callback, tstconn); } - debug_print("chatnav: connected\n"); + debug_printf("chatnav: connected\n"); break; case 0xe: /* Chat */ { @@ -691,11 +686,10 @@ int exchange = va_arg(ap, int); struct chat_connection *ccon; if (tstconn == NULL || tstconn->status & AIM_CONN_STATUS_RESOLVERR) { - debug_print("unable to connect to chat server\n"); + debug_printf("unable to connect to chat server\n"); return 1; } - sprintf(debug_buff, "Connected to chat room %s exchange %d\n", roomname, exchange); - debug_print(debug_buff); + debug_printf("Connected to chat room %s exchange %d\n", roomname, exchange); ccon = g_new0(struct chat_connection, 1); ccon->conn = tstconn; @@ -715,9 +709,7 @@ } break; default: /* huh? */ - sprintf(debug_buff, "got redirect for unknown service 0x%04x\n", - serviceid); - debug_print(debug_buff); + debug_printf("got redirect for unknown service 0x%04x\n", serviceid); break; } @@ -1204,8 +1196,7 @@ userinfo->sn, gc->username); do_ask_dialog(buf, d, accept_direct_im, cancel_direct_im); } else { - sprintf(debug_buff, "Unknown rendtype %d\n", rendtype); - debug_print(debug_buff); + debug_printf("Unknown rendtype %d\n", rendtype); } } @@ -1334,11 +1325,8 @@ msg = va_arg(ap, char *); va_end(ap); - sprintf(debug_buff, "MOTD: %s (%d)\n", msg, id); - debug_print(debug_buff); - sprintf(debug_buff, "Gaim %s / Libfaim %s\n", - VERSION, aim_getbuildstring()); - debug_print(debug_buff); + debug_printf("MOTD: %s (%d)\n", msg, id); + debug_printf("Gaim %s / Libfaim %s\n", VERSION, aim_getbuildstring()); if (id != 4) do_error_dialog(_("Your connection may be lost."), _("AOL error")); @@ -1367,11 +1355,9 @@ exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); va_end(ap); - debug_print("chat info: Chat Rights:\n"); - sprintf(debug_buff, "chat info: \tMax Concurrent Rooms: %d\n", maxrooms); - debug_print(debug_buff); - sprintf(debug_buff, "chat info: \tExchange List: (%d total)\n", exchangecount); - debug_print(debug_buff); + debug_printf("chat info: Chat Rights:\n"); + debug_printf("chat info: \tMax Concurrent Rooms: %d\n", maxrooms); + debug_printf("chat info: \tExchange List: (%d total)\n", exchangecount); while (i < exchangecount) debug_printf("chat info: \t\t%d\n", exchanges[i++].number); if (odata->create_exchange) { @@ -1414,8 +1400,7 @@ break; default: va_end(ap); - sprintf(debug_buff, "chatnav info: unknown type (%04x)\n", type); - debug_print(debug_buff); + debug_printf("chatnav info: unknown type (%04x)\n", type); break; } return 1; @@ -1485,7 +1470,7 @@ int gaim_chat_info_update(struct aim_session_t *sess, struct command_rx_struct *command, ...) { - debug_print("inside chat_info_update\n"); + debug_printf("inside chat_info_update\n"); return 1; } @@ -1531,8 +1516,7 @@ sn = va_arg(ap, char *); va_end(ap); - sprintf(debug_buff, "Sent message to %s.\n", sn); - debug_print(debug_buff); + debug_printf("Sent message to %s.\n", sn); return 1; } @@ -1545,8 +1529,7 @@ newrate = va_arg(ap, unsigned long); va_end(ap); - sprintf(debug_buff, "ratechange: %lu\n", newrate); - debug_print(debug_buff); + debug_printf("ratechange: %lu\n", newrate); return 1; } @@ -1581,7 +1564,7 @@ if (bud_list_cache_exists(gc)) do_import(NULL, gc); - debug_print("buddy list loaded\n"); + debug_printf("buddy list loaded\n"); aim_addicbmparam(sess, command->conn); aim_bos_reqicbmparaminfo(sess, command->conn); @@ -1593,9 +1576,8 @@ break; default: - sprintf(debug_buff, "got rate response for unhandled connection type %04x\n", + debug_printf("got rate response for unhandled connection type %04x\n", command->conn->type); - debug_print(debug_buff); break; } @@ -1604,10 +1586,9 @@ int gaim_reportinterval(struct aim_session_t *sess, struct command_rx_struct *command, ...) { if (command->data) { - sprintf(debug_buff, "minimum report interval: %d (seconds?)\n", aimutil_get16(command->data+10)); - debug_print(debug_buff); + debug_printf("minimum report interval: %d (seconds?)\n", aimutil_get16(command->data+10)); } else - debug_print("NULL minimum report interval!\n"); + debug_printf("NULL minimum report interval!\n"); return 1; } @@ -1620,8 +1601,7 @@ maxwatchers = (u_short)va_arg(ap, u_int); va_end(ap); - sprintf(debug_buff, "buddy list rights: Max buddies = %d / Max watchers = %d\n", maxbuddies, maxwatchers); - debug_print(debug_buff); + debug_printf("buddy list rights: Max buddies = %d / Max watchers = %d\n", maxbuddies, maxwatchers); return 1; } @@ -1635,8 +1615,7 @@ maxdenies = (u_short)va_arg(ap, u_int); va_end(ap); - sprintf(debug_buff, "BOS rights: Max permit = %d / Max deny = %d\n", maxpermits, maxdenies); - debug_print(debug_buff); + debug_printf("BOS rights: Max permit = %d / Max deny = %d\n", maxpermits, maxdenies); aim_bos_clientready(sess, command->conn); @@ -1746,14 +1725,13 @@ static void oscar_join_chat(struct gaim_connection *g, int exchange, char *name) { struct oscar_data *odata = (struct oscar_data *)g->proto_data; struct aim_conn_t *cur = NULL; - sprintf(debug_buff, "Attempting to join chat room %s.\n", name); - debug_print(debug_buff); + debug_printf("Attempting to join chat room %s.\n", name); if ((cur = aim_getconn_type(odata->sess, AIM_CONN_TYPE_CHATNAV))) { - debug_print("chatnav exists, creating room\n"); + debug_printf("chatnav exists, creating room\n"); aim_chatnav_createroom(odata->sess, cur, name, exchange); } else { /* this gets tricky */ - debug_print("chatnav does not exist, opening chatnav\n"); + debug_printf("chatnav does not exist, opening chatnav\n"); odata->create_exchange = exchange; odata->create_name = g_strdup(name); aim_bos_reqservice(odata->sess, odata->conn, AIM_CONN_TYPE_CHATNAV); @@ -1799,9 +1777,7 @@ if (!b) return; - sprintf(debug_buff, "Attempting to leave room %s (currently in %d rooms)\n", - b->name, count); - debug_print(debug_buff); + debug_printf("Attempting to leave room %s (currently in %d rooms)\n", b->name, count); c = find_oscar_chat(g, b->id); if (c != NULL) { @@ -2057,21 +2033,22 @@ GtkWidget *label; GtkWidget *entry; - vbox = gtk_vbox_new(FALSE, 0); + 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, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); + 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("Authorizer:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); + 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, 5); + 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); @@ -2082,16 +2059,16 @@ 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, 5); + 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("Authorizer Port:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); + 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, 5); + gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); gtk_object_set_user_data(GTK_OBJECT(entry), (void *)1); gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(oscar_print_option), user); @@ -2102,16 +2079,16 @@ gtk_entry_set_text(GTK_ENTRY(entry), "5190"); gtk_widget_show(entry); - hbox = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); + 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("SOCKS5 Host:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); + 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, 5); + gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSHOST); gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(oscar_print_option), user); @@ -2121,16 +2098,16 @@ } gtk_widget_show(entry); - hbox = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); + 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("SOCKS5 Port:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); + 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, 5); + gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSPORT); gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(oscar_print_option), user);
--- a/src/perl.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/perl.c Wed Dec 13 20:18:35 2000 +0000 @@ -564,8 +564,7 @@ handler->event_type = g_strdup(SvPV(ST(0), junk)); handler->handler_name = g_strdup(SvPV(ST(1), junk)); perl_event_handlers = g_list_append(perl_event_handlers, handler); - sprintf(debug_buff, "registered perl event handler for %s\n", handler->event_type); - debug_print(debug_buff); + debug_printf("registered perl event handler for %s\n", handler->event_type); XSRETURN_EMPTY; }
--- a/src/plugins.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/plugins.c Wed Dec 13 20:18:35 2000 +0000 @@ -198,9 +198,7 @@ g = (struct gaim_callback *)c->data; if (g->handle == plug->handle) { callbacks = g_list_remove(callbacks, c->data); - sprintf(debug_buff, "Removing callback, %d remain\n", - g_list_length(callbacks)); - debug_print(debug_buff); + debug_printf("Removing callback, %d remain\n", g_list_length(callbacks)); c = callbacks; if (c == NULL) { break; @@ -419,20 +417,16 @@ if (!p) return; - sprintf(debug_buff, "Unloading %s\n", g_module_name(p->handle)); - debug_print(debug_buff); + debug_printf("Unloading %s\n", g_module_name(p->handle)); - sprintf(debug_buff, "%d callbacks to search\n", g_list_length(callbacks)); - debug_print(debug_buff); + debug_printf("%d callbacks to search\n", g_list_length(callbacks)); while (c) { g = (struct gaim_callback *)c->data; if (g->handle == p->handle) { callbacks = g_list_remove(callbacks, c->data); g_free(g); - sprintf(debug_buff, "Removing callback, %d remain\n", - g_list_length(callbacks)); - debug_print(debug_buff); + debug_printf("Removing callback, %d remain\n", g_list_length(callbacks)); c = callbacks; if (c == NULL) { break; @@ -507,8 +501,7 @@ call->data = data; callbacks = g_list_append(callbacks, call); - sprintf(debug_buff, "Adding callback %d\n", g_list_length(callbacks)); - debug_print(debug_buff); + debug_printf("Adding callback %d\n", g_list_length(callbacks)); } void gaim_signal_disconnect(GModule *handle, enum gaim_event which, void *func) { @@ -726,8 +719,7 @@ break; default: - sprintf(debug_buff, "unknown event %d\n", event); - debug_print(debug_buff); + debug_printf("unknown event %d\n", event); break; } } @@ -812,8 +804,7 @@ break; } tmp = event_name(event); - g_snprintf(debug_buff, sizeof debug_buff, "%s: %s\n", tmp, buf); - debug_print(debug_buff); + debug_printf("%s: %s\n", tmp, buf); return perl_event(tmp, buf); #else return 0;
--- a/src/prefs.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/prefs.c Wed Dec 13 20:18:35 2000 +0000 @@ -1884,8 +1884,6 @@ gtk_widget_show(prefs); } -char debug_buff[BUF_LONG]; - static gint debug_delete(GtkWidget *w, GdkEvent *event, void *dummy) { if (debugbutton) @@ -1939,15 +1937,6 @@ } } -void debug_print(char *chars) -{ - if (general_options & OPT_GEN_DEBUG && dw) - gtk_text_insert(GTK_TEXT(dw->entry), NULL, NULL, NULL, chars, strlen(chars)); -#ifdef DEBUG - printf("%s", chars); -#endif -} - void debug_printf(char *fmt, ...) { va_list ap; @@ -1959,6 +1948,9 @@ va_end(ap); gtk_text_insert(GTK_TEXT(dw->entry), NULL, NULL, NULL, s, -1); +#ifdef DEBUG + printf("%s", chars); +#endif g_free(s); } }
--- a/src/rvous.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/rvous.c Wed Dec 13 20:18:35 2000 +0000 @@ -295,8 +295,7 @@ return; } - sprintf(debug_buff, "header length %d\n", header.hdrlen); - debug_print(debug_buff); + debug_printf("header length %d\n", header.hdrlen); header.hdrtype = 0x202; @@ -307,8 +306,7 @@ header.encrypt = 0; header.compress = 0; header.totparts = 1; header.partsleft = 1; - sprintf(debug_buff, "sending confirmation\n"); - debug_print(debug_buff); + debug_printf("sending confirmation\n"); write_file_header(ft->fd, &header); rcv = 0; @@ -335,9 +333,7 @@ aol_icon(fw->window); gtk_widget_show(fw); - sprintf(debug_buff, "Receiving %s from %s (%d bytes)\n", ft->filename, - ft->user, ft->size); - debug_print(debug_buff); + debug_printf("Receiving %s from %s (%d bytes)\n", ft->filename, ft->user, ft->size); fcntl(ft->fd, F_SETFL, O_NONBLOCK); @@ -380,8 +376,7 @@ return; } - sprintf(debug_buff, "Download complete.\n"); - debug_print(debug_buff); + debug_printf("Download complete.\n"); header.hdrtype = 0x402; header.totparts = 0; header.partsleft = 0; @@ -431,9 +426,7 @@ } if (fhdr.hdrtype != 0xc12) { - sprintf(debug_buff, "%s decided to cancel. (%x)\n", ft->user, - fhdr.hdrtype); - debug_print(debug_buff); + debug_printf("%s decided to cancel. (%x)\n", ft->user, fhdr.hdrtype); fclose(ft->f); close(ft->fd); free_ft(ft); @@ -472,9 +465,7 @@ aol_icon(fw->window); gtk_widget_show(fw); - sprintf(debug_buff, "Sending %s to %s (%ld bytes)\n", fhdr.name, - ft->user, fhdr.totsize); - debug_print(debug_buff); + debug_printf("Sending %s to %s (%ld bytes)\n", fhdr.name, ft->user, fhdr.totsize); rcv = 0; cont = 1; while (rcv != ntohl(fhdr.totsize) && cont) { @@ -515,8 +506,7 @@ return; } - sprintf(debug_buff, "Upload complete.\n"); - debug_print(debug_buff); + debug_printf("Upload complete.\n"); read_file_header(ft->fd, &fhdr); @@ -583,8 +573,7 @@ c = file + strlen(file); while (*(c - 1) != '/') c--; buf2 = frombase64(ft->cookie); - sprintf(debug_buff, "Building header to send %s (cookie: %s)\n", file, buf2); - debug_print(debug_buff); + debug_printf("Building header to send %s (cookie: %s)\n", file, buf2); fhdr.magic[0] = 'O'; fhdr.magic[1] = 'F'; fhdr.magic[2] = 'T'; fhdr.magic[3] = '2'; fhdr.hdrlen = htons(256); @@ -619,20 +608,17 @@ snprintf(fhdr.name, 64, "listing.txt"); read_rv = write_file_header(ft->fd, &fhdr); if (read_rv <= -1) { - sprintf(debug_buff, "Couldn't write opening header\n"); - debug_print(debug_buff); + debug_printf("Couldn't write opening header\n"); close(ft->fd); free_ft(ft); return; } /* 2. receive header */ - sprintf(debug_buff, "Receiving header\n"); - debug_print(debug_buff); + debug_printf("Receiving header\n"); read_rv = read_file_header(ft->fd, &fhdr); if (read_rv <= -1) { - sprintf(debug_buff, "Couldn't read header\n"); - debug_print(debug_buff); + debug_printf("Couldn't read header\n"); close(ft->fd); free_ft(ft); return; @@ -641,34 +627,28 @@ /* 3. send listing file */ /* mm/dd/yyyy hh:mm sizesize name.ext\r\n */ /* creation date ^ */ - sprintf(debug_buff, "Sending file\n"); - debug_print(debug_buff); + debug_printf("Sending file\n"); fortime = localtime(&st.st_ctime); at = g_snprintf(buf, ntohl(fhdr.size) + 1, "%2d/%2d/%4d %2d:%2d %8ld ", fortime->tm_mon + 1, fortime->tm_mday, fortime->tm_year + 1900, fortime->tm_hour + 1, fortime->tm_min + 1, (long)st.st_size); g_snprintf(buf + at, ntohl(fhdr.size) + 1 - at, "%s\r\n", c); - sprintf(debug_buff, "Sending listing.txt (%d bytes) to %s\n", - ntohl(fhdr.size) + 1, ft->user); - debug_print(debug_buff); + debug_printf("Sending listing.txt (%d bytes) to %s\n", ntohl(fhdr.size) + 1, ft->user); read_rv = write(ft->fd, buf, ntohl(fhdr.size)); if (read_rv <= -1) { - sprintf(debug_buff, "Could not send file, wrote %d\n", rcv); - debug_print(debug_buff); + debug_printf("Could not send file, wrote %d\n", rcv); close(ft->fd); free_ft(ft); return; } /* 4. receive header */ - sprintf(debug_buff, "Receiving closing header\n"); - debug_print(debug_buff); + debug_printf("Receiving closing header\n"); read_rv = read_file_header(ft->fd, &fhdr); if (read_rv <= -1) { - sprintf(debug_buff, "Couldn't read closing header\n"); - debug_print(debug_buff); + debug_printf("Couldn't read closing header\n"); close(ft->fd); free_ft(ft); return;
--- a/src/server.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/server.c Wed Dec 13 20:18:35 2000 +0000 @@ -412,8 +412,7 @@ } if (!b) { - sprintf(debug_buff,"Error, no such person\n"); - debug_print(debug_buff); + debug_printf("Error, no such person\n"); return; } @@ -661,8 +660,7 @@ plugin_event(event_chat_leave, g, b->name, 0, 0); - sprintf(debug_buff, "Leaving room %s.\n", b->name); - debug_print(debug_buff); + debug_printf("Leaving room %s.\n", b->name); g->buddy_chats = g_slist_remove(g->buddy_chats, b); @@ -711,10 +709,10 @@ void update_keepalive(struct gaim_connection *gc, gboolean on) { if (on && !gc->keepalive && blist) { - debug_print("allowing NOP\n"); + debug_printf("allowing NOP\n"); gc->keepalive = gtk_timeout_add(60000, (GtkFunction)send_keepalive, gc); } else if (!on && gc->keepalive > 0) { - debug_print("removing NOP\n"); + debug_printf("removing NOP\n"); gtk_timeout_remove(gc->keepalive); gc->keepalive = 0; }
--- a/src/toc.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/toc.c Wed Dec 13 20:18:35 2000 +0000 @@ -47,7 +47,7 @@ #include "pixmaps/dt_icon.xpm" #include "pixmaps/free_icon.xpm" -#define REVISION "gaim:$Revision: 1244 $" +#define REVISION "gaim:$Revision: 1260 $" #define TYPE_SIGNON 1 #define TYPE_DATA 2 @@ -736,14 +736,12 @@ gc->deny = g_slist_append(gc->deny, name); } else if (!strncmp("toc", c, 3)) { sscanf(c + strlen(c) - 1, "%d", &gc->permdeny); - sprintf(debug_buff, "permdeny: %d\n", gc->permdeny); - debug_print(debug_buff); + debug_printf("permdeny: %d\n", gc->permdeny); if (gc->permdeny == 0) gc->permdeny = 1; } else if (*c == 'm') { sscanf(c + 2, "%d", &gc->permdeny); - sprintf(debug_buff, "permdeny: %d\n", gc->permdeny); - debug_print(debug_buff); + debug_printf("permdeny: %d\n", gc->permdeny); if (gc->permdeny == 0) gc->permdeny = 1; } @@ -817,9 +815,8 @@ char buf[BUF_LONG]; g_snprintf(buf, sizeof(buf)/2, "toc_dir_search %s:%s:%s:%s:%s:%s:%s:%s", first, middle, last, maiden, city, state, country, email); - sprintf(debug_buff,"Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden, + debug_printf("Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden, city, state, country); - debug_print(debug_buff); sflap_send(g, buf, -1, TYPE_DATA); } @@ -1031,22 +1028,23 @@ GtkWidget *entry; GtkWidget *first, *opt; - vbox = gtk_vbox_new(FALSE, 0); + 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, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); + 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("TOC Host:"); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); + 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, 5); + 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); @@ -1058,16 +1056,16 @@ gtk_widget_show(entry); hbox = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); + 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, 5); + 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, 5); + gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); gtk_object_set_user_data(GTK_OBJECT(entry), (void *)1); gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); @@ -1081,15 +1079,15 @@ hbox = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 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_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, 5); + gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSHOST); gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); @@ -1101,15 +1099,15 @@ hbox = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 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_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, 5); + gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSPORT); gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user);
--- a/src/util.c Wed Dec 13 06:39:24 2000 +0000 +++ b/src/util.c Wed Dec 13 20:18:35 2000 +0000 @@ -403,8 +403,7 @@ if (stat(log_all_file, &st) < 0) flag = 1; - sprintf(debug_buff,"Logging to: \"%s\"\n", log_all_file); - debug_print(debug_buff); + debug_printf("Logging to: \"%s\"\n", log_all_file); fd = fopen(log_all_file, "a"); @@ -428,8 +427,7 @@ int cnt=0; /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */ if (strlen(msg) > BUF_LEN) { - sprintf(debug_buff, "Warning: truncating message to 2048 bytes\n"); - debug_print(debug_buff); + debug_printf("Warning: truncating message to 2048 bytes\n"); msg[2047]='\0'; }