Mercurial > pidgin
changeset 5213:1cf4eb75e3ee
[gaim-migrate @ 5583]
More debug_printf -> gaim_debug.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 26 Apr 2003 07:15:59 +0000 |
parents | 740303e8425b |
children | 7ea282e1f615 |
files | src/away.c src/browser.c src/buddy.c src/conversation.c src/core.c src/dialogs.c |
diffstat | 6 files changed, 120 insertions(+), 77 deletions(-) [+] |
line wrap: on
line diff
--- a/src/away.c Sat Apr 26 06:46:59 2003 +0000 +++ b/src/away.c Sat Apr 26 07:15:59 2003 +0000 @@ -65,7 +65,8 @@ gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), iter, 0, &name, -1); - debug_printf("Unqueueing messages from %s.\n", name); + gaim_debug(GAIM_DEBUG_INFO, "away", "Unqueueing messages from %s.\n", + name); templist = message_queue;
--- a/src/browser.c Sat Apr 26 06:46:59 2003 +0000 +++ b/src/browser.c Sat Apr 26 07:15:59 2003 +0000 @@ -261,16 +261,18 @@ } if (!XQueryTree(gdk_display, root, &root2, &parent, &kids, &nkids)) { - debug_printf("%s: XQueryTree failed on display %s\n", progname, - DisplayString(gdk_display)); + gaim_debug(GAIM_DEBUG_ERROR, "browser", + "%s: XQueryTree failed on display %s\n", + progname, DisplayString(gdk_display)); return NULL; } /* root != root2 is possible with virtual root WMs. */ if (!(kids && nkids)) { - debug_printf("%s: root window has no children on display %s\n", - progname, DisplayString(gdk_display)); + gaim_debug(GAIM_DEBUG_ERROR, "browser", + "%s: root window has no children on display %s\n", + progname, DisplayString(gdk_display)); return NULL; } @@ -298,23 +300,27 @@ XFree(kids); 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); + gaim_debug(GAIM_DEBUG_WARNING, "browser", + "%s: both version %s (0x%x) and version %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); + gaim_debug(GAIM_DEBUG_WARNING, "browser", + "%s: expected version %s but found version %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)); + gaim_debug(GAIM_DEBUG_ERROR, "%s: not running on display %s\n", + progname, DisplayString(gdk_display)); return NULL; } } @@ -352,18 +358,20 @@ &actual_type, &actual_format, &nitems, &data)) { /* 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); + gaim_debug(GAIM_DEBUG_MISC, "browser", + "%s: writing " MOZILLA_LOCK_PROP " \"%s\" to 0x%x\n", + progname, lock_data, (unsigned int)window); - gdk_property_change(window, GDKA_MOZILLA_LOCK, - gdk_x11_xatom_to_atom (XA_STRING), - 8, PropModeReplace, - (unsigned char *)lock_data, strlen(lock_data)); - locked = True; - } + gdk_property_change(window, GDKA_MOZILLA_LOCK, + gdk_x11_xatom_to_atom (XA_STRING), + 8, PropModeReplace, + (unsigned char *)lock_data, strlen(lock_data)); + locked = True; + } - if (data) - g_free(data); + if (data) + g_free(data); + gdk_x11_ungrab_server(); } @@ -377,8 +385,9 @@ unsigned char *data = 0; const char *lock_data = get_lock_data(); - debug_printf("%s: (deleting " MOZILLA_LOCK_PROP - " \"%s\" from 0x%x)\n", progname, lock_data, (unsigned int)window); + gaim_debug(GAIM_DEBUG_MISC, "browser", + "%s: deleting " MOZILLA_LOCK_PROP " \"%s\" from 0x%x\n", + progname, lock_data, (unsigned int)window); result = gdk_property_get(window, GDKA_MOZILLA_LOCK, gdk_x11_xatom_to_atom (XA_STRING), @@ -386,15 +395,19 @@ 1, &actual_type, &actual_format, &nitems, &data); if (result != TRUE) { - debug_printf("%s: unable to read and delete " MOZILLA_LOCK_PROP " property\n", progname); + gaim_debug(GAIM_DEBUG_ERROR, "browser", + "%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); + gaim_debug(GAIM_DEBUG_ERROR, "browser", + "%s: Invalid data on " MOZILLA_LOCK_PROP + " of wnidow 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); + gaim_debug(GAIM_DEBUG_ERROR, "browser", + "%s: " MOZILLA_LOCK_PROP " was stolen! Expected \"%s\", " + "saw \"%s\"!\n", progname, lock_data, data); return; } @@ -412,7 +425,8 @@ if (window == NULL || GDK_WINDOW_OBJECT(window)->destroyed) { do_error_dialog(_("Communication with the browser failed. Please close all " "windows and try again."), NULL, GAIM_ERROR); - debug_printf("netscape_response_cb called with NULL window.\n"); + gaim_debug(GAIM_DEBUG_WARNING, "browser", + "netscape_response_cb called with NULL window.\n"); return GDK_FILTER_CONTINUE; } @@ -442,13 +456,15 @@ if (data[0] == '1') { /* Netscape isn't ready yet */ - debug_printf("Remote Netscape window isn't ready yet.\n"); + gaim_debug(GAIM_DEBUG_ERROR, "browser", + "Remote Netscape window isn't ready yet.\n"); return GDK_FILTER_REMOVE; } if (data[0] == '2') { /* Yay! It worked */ - debug_printf("Successfully sent command to remote Netscape window.\n"); + gaim_debug(GAIM_DEBUG_INFO, "browser", + "Successfully sent command to remote Netscape window.\n"); } gdk_window_remove_filter(window, (GdkFilterFunc) netscape_response_cb, window); @@ -476,8 +492,9 @@ command = new_command; } - debug_printf("%s: (writing " MOZILLA_COMMAND_PROP " \"%s\" to 0x%x)\n", - progname, command, (unsigned int)window); + gaim_debug(GAIM_DEBUG_MISC, "browser", + "%s: Writing " MOZILLA_COMMAND_PROP " \"%s\" to 0x%x\n", + progname, command, (unsigned int)window); gdk_property_change(window, GDKA_MOZILLA_COMMAND, gdk_x11_xatom_to_atom (XA_STRING), @@ -491,7 +508,8 @@ GdkWindow *window = NULL; if (netscape_lock) { - debug_printf("netscape_command() is currently in use.\n"); + gaim_debug(GAIM_DEBUG_WARNING, "browser", + "netscape_command() is currently in use.\n"); return FALSE; } @@ -501,7 +519,8 @@ window = mozilla_remote_find_window(); if (window == NULL || (GDK_WINDOW_OBJECT(window)->destroyed == TRUE)) { - debug_printf("Remote window absent or unsuitable.\n"); + gaim_debug(GAIM_DEBUG_ERROR, "browser", + "Remote window absent or unsuitable.\n"); netscape_lock = 0; return FALSE; }
--- a/src/buddy.c Sat Apr 26 06:46:59 2003 +0000 +++ b/src/buddy.c Sat Apr 26 07:15:59 2003 +0000 @@ -1720,7 +1720,9 @@ } else { /* we're logging in or something... do nothing */ /* or should I make the blist? */ - debug_printf("docklet_toggle called with connections but no blist!\n"); + gaim_debug(GAIM_DEBUG_WARNING, "blist", + "docklet_toggle called with connections " + "but no blist!\n"); } } else if (mainwindow) { if (GTK_WIDGET_VISIBLE(mainwindow)) {
--- a/src/conversation.c Sat Apr 26 06:46:59 2003 +0000 +++ b/src/conversation.c Sat Apr 26 07:15:59 2003 +0000 @@ -163,7 +163,7 @@ /* XXX Somebody add const stuff! */ serv_send_typing(gc, (char *)name, TYPED); - debug_printf("typed...\n"); + gaim_debug(GAIM_DEBUG_MISC, "conversation", "typed...\n"); } return FALSE; @@ -269,8 +269,10 @@ id++; if (stat(img_filename, &st) != 0) { - debug_printf("Could not stat %s\n", - (char *)img_filename); + gaim_debug(GAIM_DEBUG_ERROR, "conversation", + "Could not stat image %s\n", + img_filename); + continue; } @@ -290,7 +292,8 @@ filename, id, (int)st.st_size); if (strstr(buffy, imgtag) == 0) { - debug_printf("Not sending image: %s\n", img_filename); + gaim_debug(GAIM_DEBUG_ERROR, "conversation", + "Not sending image: %s\n", img_filename); continue; } @@ -314,7 +317,8 @@ bigbuf = g_realloc(bigbuf, length + 1); if ((imgfile = fopen(img_filename, "r")) == NULL) { - debug_printf("Could not open %s\n", img_filename); + gaim_debug(GAIM_DEBUG_ERROR, "conversation", + "Could not open image %s\n", img_filename); continue; } @@ -394,14 +398,18 @@ g_free(buf); if (err < 0) { - if (err == -E2BIG) + if (err == -E2BIG) { do_error_dialog(_("Unable to send message. " "The message is too large."), NULL, GAIM_ERROR); - else if (err == -ENOTCONN) - debug_printf("Not yet connected.\n"); - else + } + else if (err == -ENOTCONN) { + gaim_debug(GAIM_DEBUG_ERROR, "conversation", + "Not yet connected.\n"); + } + else { do_error_dialog(_("Unable to send message."), NULL, GAIM_ERROR); + } } else { if (err > 0 && (away_options & OPT_AWAY_BACK_ON_IM)) { @@ -693,7 +701,8 @@ if (l == NULL) { /* Should never happen. */ - debug_printf("Misordered conversations list in window %p\n", win); + gaim_debug(GAIM_DEBUG_ERROR, "conversation", + "Misordered conversations list in window %p\n", win); return; }
--- a/src/core.c Sat Apr 26 06:46:59 2003 +0000 +++ b/src/core.c Sat Apr 26 07:15:59 2003 +0000 @@ -178,7 +178,8 @@ cui_packet_free(p); break; default: - debug_printf("unhandled meta subtype %d\n", subtype); + gaim_debug(GAIM_DEBUG_WARNING, "cui", + "Unhandled meta subtype %d\n", subtype); break; } @@ -208,7 +209,8 @@ } break; default: - debug_printf("unhandled plugin subtype %d\n", subtype); + gaim_debug(GAIM_DEBUG_WARNING, "cui", + "Unhandled plugin subtype %d\n", subtype); break; } #endif @@ -240,7 +242,8 @@ /* don't need to do anything here because the UI will get updates from other handlers */ break; default: - debug_printf("unhandled user subtype %d\n", subtype); + gaim_debug(GAIM_DEBUG_WARNING, "cui", + "Unhandled user subtype %d\n", subtype); break; } } @@ -287,7 +290,8 @@ case CUI_MESSAGE_RECV: break; default: - debug_printf("unhandled message subtype %d\n", subtype); + gaim_debug(GAIM_DEBUG_WARNING, "cui", + "Unhandled message subtype %d\n", subtype); break; } } @@ -329,7 +333,8 @@ /* report error */ break; default: - debug_printf("Unhandled remote subtype %d\n", subtype); + gaim_debug(GAIM_DEBUG_WARNING, "cui", + "Unhandled remote subtype %d\n", subtype); break; } } @@ -348,7 +353,7 @@ /* no byte order worries! this'll change if we go to TCP */ if (gaim_recv(source, &type, sizeof(type)) != sizeof(type)) { - debug_printf("UI has abandoned us!\n"); + gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n"); uis = g_slist_remove(uis, ui); g_io_channel_shutdown(ui->channel, TRUE, &error); if(error) { @@ -361,7 +366,7 @@ } if (gaim_recv(source, &subtype, sizeof(subtype)) != sizeof(subtype)) { - debug_printf("UI has abandoned us!\n"); + gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n"); uis = g_slist_remove(uis, ui); g_io_channel_shutdown(ui->channel, TRUE, &error); if(error) { @@ -374,7 +379,7 @@ } if (gaim_recv(source, (guchar *)&len, sizeof(len)) != sizeof(len)) { - debug_printf("UI has abandoned us!\n"); + gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n"); uis = g_slist_remove(uis, ui); g_io_channel_shutdown(ui->channel, TRUE, &error); if(error) { @@ -389,7 +394,7 @@ if (len) { in = g_new0(guchar, len); if (gaim_recv(source, in, len) != len) { - debug_printf("UI has abandoned us!\n"); + gaim_debug(GAIM_DEBUG_ERROR, "cui", "UI has abandoned us!\n"); uis = g_slist_remove(uis, ui); g_io_channel_shutdown(ui->channel, TRUE, &error); if(error) { @@ -432,8 +437,9 @@ case CUI_TYPE_REMOTE: remote_handler(ui, subtype, in, len); break; - default: - debug_printf("unhandled type %d\n", type); + default: + gaim_debug(GAIM_DEBUG_WARNING, "cui", + "Unhandled type %d\n", type); break; } @@ -460,7 +466,7 @@ ui->inpa = g_io_add_watch(ui->channel, G_IO_IN | G_IO_HUP | G_IO_ERR, UI_readable, ui); g_io_channel_unref(ui->channel); - debug_printf("got one\n"); + gaim_debug(GAIM_DEBUG_MISC, "cui", "Got one\n"); return TRUE; } @@ -472,7 +478,7 @@ while (gaim_session_exists(gaim_session)) gaim_session++; - debug_printf("session: %d\n", gaim_session); + gaim_debug(GAIM_DEBUG_MISC, "cui", "Session: %d\n", gaim_session); if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) != -1) { mode_t m = umask(0177); @@ -530,12 +536,13 @@ { /* don't save prefs after plugins are gone... */ #ifndef _WIN32 - { char buf[1024]; close(UI_fd); - sprintf(buf, "%s" G_DIR_SEPARATOR_S "gaim_%s.%d", g_get_tmp_dir(), g_get_user_name(), gaim_session); + sprintf(buf, "%s" G_DIR_SEPARATOR_S "gaim_%s.%d", + g_get_tmp_dir(), g_get_user_name(), gaim_session); + unlink(buf); - debug_printf("Removed core\n"); - } + + gaim_debug(GAIM_DEBUG_MISC, "core", "Removed core\n"); #endif }
--- a/src/dialogs.c Sat Apr 26 06:46:59 2003 +0000 +++ b/src/dialogs.c Sat Apr 26 07:15:59 2003 +0000 @@ -415,7 +415,8 @@ g = gaim_find_buddys_group(b); name = g_strdup(b->name); /* b->name is null after remove_buddy */ - debug_printf(_("Removing '%s' from buddy list.\n"), b->name); + gaim_debug(GAIM_DEBUG_INFO, "blist", + "Removing '%s' from buddy list.\n", b->name); serv_remove_buddy(b->account->gc, name, g->name); gaim_blist_remove_buddy(b); gaim_blist_save(); @@ -1191,7 +1192,8 @@ { if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) return; - debug_printf("setting deny mode %d\n", data); + + gaim_debug(GAIM_DEBUG_INFO, "privacy", "Setting deny mode %d\n", data); current_deny_gc->account->permdeny = data; serv_set_permit_deny(current_deny_gc); gaim_blist_save(); @@ -2702,10 +2704,11 @@ text_color.green / 256, text_color.blue / 256); gaim_gtk_surround(gtkconv, open_tag, "</FONT>"); - debug_printf("#%02X%02X%02X\n", - text_color.red / 256, - text_color.green / 256, - text_color.blue / 256); + + gaim_debug(GAIM_DEBUG_MISC, "fgcolor dialog", "#%02X%02X%02X\n", + text_color.red / 256, + text_color.green / 256, + text_color.blue / 256); g_free(open_tag); cancel_fgcolor(NULL, c); } @@ -2732,10 +2735,11 @@ text_color.green / 256, text_color.blue / 256); gaim_gtk_surround(gtkconv, open_tag, "</BODY>"); - debug_printf("#%02X%02X%02X\n", - text_color.red / 256, - text_color.green / 256, - text_color.blue / 256); + gaim_debug(GAIM_DEBUG_MISC, "bgcolor dialog", "#%02X%02X%02X\n", + text_color.red / 256, + text_color.green / 256, + text_color.blue / 256); + g_free(open_tag); cancel_bgcolor(NULL, c); } @@ -4126,7 +4130,8 @@ if (iconfile) { char *filename; filename = g_build_filename (DATADIR, "pixmaps", "gaim", "buttons", iconfile, NULL); - debug_printf("Loading: %s\n", filename); + gaim_debug(GAIM_DEBUG_MISC, "gaim_pixbuf_button", + "Loading: %s\n", filename); image = gtk_image_new_from_file(filename); gtk_box_pack_end(GTK_BOX(ibox), image, FALSE, FALSE, 0); g_free(filename);