Mercurial > pidgin
changeset 27432:35b6fd563056
Change all MSN_DEBUG_* messages to use the new purple_debug_is_verbose call
for runtime switching.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 10 Jul 2009 00:51:31 +0000 |
parents | 9c413bda20be |
children | 0491bd8a2a60 |
files | libpurple/protocols/msn/httpconn.c libpurple/protocols/msn/msg.c libpurple/protocols/msn/msn.h libpurple/protocols/msn/notification.c libpurple/protocols/msn/slp.c libpurple/protocols/msn/slpcall.c libpurple/protocols/msn/slpmsg.c libpurple/protocols/msn/slpmsg.h libpurple/protocols/msn/switchboard.c |
diffstat | 9 files changed, 63 insertions(+), 141 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/httpconn.c Thu Jul 09 05:37:37 2009 +0000 +++ b/libpurple/protocols/msn/httpconn.c Fri Jul 10 00:51:31 2009 +0000 @@ -161,10 +161,9 @@ memcpy(body, body_start, body_len); body[body_len] = '\0'; -#ifdef MSN_DEBUG_HTTP - purple_debug_misc("msn", "Incoming HTTP buffer (header): {%s}\n", - header); -#endif + if (purple_debug_is_verbose()) + purple_debug_misc("msn", "Incoming HTTP buffer (header): {%s}\n", + header); /* Now we should be able to process the data. */ if ((s = purple_strcasestr(header, "X-MSN-Messenger: ")) != NULL)
--- a/libpurple/protocols/msn/msg.c Thu Jul 09 05:37:37 2009 +0000 +++ b/libpurple/protocols/msn/msg.c Fri Jul 10 00:51:31 2009 +0000 @@ -33,9 +33,8 @@ msg = g_new0(MsnMessage, 1); msg->type = type; -#ifdef MSN_DEBUG_MSG - purple_debug_info("msn", "message new (%p)(%d)\n", msg, type); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "message new (%p)(%d)\n", msg, type); msg->attr_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); @@ -57,9 +56,8 @@ return; } -#ifdef MSN_DEBUG_MSG - purple_debug_info("msn", "message destroy (%p)\n", msg); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "message destroy (%p)\n", msg); g_free(msg->remote_user); g_free(msg->body); @@ -79,9 +77,8 @@ msg->ref_count++; -#ifdef MSN_DEBUG_MSG - purple_debug_info("msn", "message ref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "message ref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); return msg; } @@ -94,9 +91,8 @@ msg->ref_count--; -#ifdef MSN_DEBUG_MSG - purple_debug_info("msn", "message unref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "message unref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); if (msg->ref_count == 0) {
--- a/libpurple/protocols/msn/msn.h Thu Jul 09 05:37:37 2009 +0000 +++ b/libpurple/protocols/msn/msn.h Fri Jul 10 00:51:31 2009 +0000 @@ -24,17 +24,6 @@ #ifndef _MSN_H_ #define _MSN_H_ -/* #define MSN_DEBUG_MSG 1 */ -/* #define MSN_DEBUG_SLPMSG 1 */ -/* #define MSN_DEBUG_HTTP 1 */ - -/* #define MSN_DEBUG_SLP 1 */ -/* #define MSN_DEBUG_SLP_VERBOSE 1 */ -/* #define MSN_DEBUG_SLP_FILES 1 */ - -/* #define MSN_DEBUG_NS 1 */ -/* #define MSN_DEBUG_SB 1 */ - #include "internal.h" #include "account.h"
--- a/libpurple/protocols/msn/notification.c Thu Jul 09 05:37:37 2009 +0000 +++ b/libpurple/protocols/msn/notification.c Fri Jul 10 00:51:31 2009 +0000 @@ -310,9 +310,8 @@ msg = msn_message_new_from_cmd(cmdproc->session, cmd); msn_message_parse_payload(msg, payload, len, MSG_LINE_DEM, MSG_BODY_DEM); -#ifdef MSN_DEBUG_NS - msn_message_show_readable(msg, "Notification", TRUE); -#endif + if (purple_debug_is_verbose()) + msn_message_show_readable(msg, "Notification", TRUE); msn_cmdproc_process_msg(cmdproc, msg); @@ -376,9 +375,8 @@ msg = msn_message_new_from_cmd(cmdproc->session, cmd); msn_message_parse_payload(msg, payload, len,MSG_LINE_DEM,MSG_BODY_DEM); -#ifdef MSN_DEBUG_NS - msn_message_show_readable(msg, "Notification", TRUE); -#endif + if (purple_debug_is_verbose()) + msn_message_show_readable(msg, "Notification", TRUE); gc = cmdproc->session->account->gc; passport = msg->remote_user;
--- a/libpurple/protocols/msn/slp.c Thu Jul 09 05:37:37 2009 +0000 +++ b/libpurple/protocols/msn/slp.c Fri Jul 10 00:51:31 2009 +0000 @@ -34,8 +34,6 @@ /* ms to delay between sending buddy icon requests to the server. */ #define BUDDY_ICON_DELAY 20 -/*debug SLP*/ -#define MSN_DEBUG_UD static void send_ok(MsnSlpCall *slpcall, const char *branch, const char *type, const char *content); @@ -212,10 +210,8 @@ "MSNSLP/1.0 200 OK", branch, type, content); -#ifdef MSN_DEBUG_SLP slpmsg->info = "SLP 200 OK"; slpmsg->text_body = TRUE; -#endif msn_slplink_queue_slpmsg(slplink, slpmsg); @@ -236,10 +232,8 @@ "MSNSLP/1.0 603 Decline", branch, type, content); -#ifdef MSN_DEBUG_SLP slpmsg->info = "SLP 603 Decline"; slpmsg->text_body = TRUE; -#endif msn_slplink_queue_slpmsg(slplink, slpmsg); } @@ -309,18 +303,14 @@ slpmsg->slpcall = slpcall; slpmsg->session_id = slpcall->session_id; msn_slpmsg_set_body(slpmsg, NULL, 4); -#ifdef MSN_DEBUG_SLP slpmsg->info = "SLP DATA PREP"; -#endif msn_slplink_queue_slpmsg(slplink, slpmsg); /* DATA */ slpmsg = msn_slpmsg_new(slplink); slpmsg->slpcall = slpcall; slpmsg->flags = 0x20; -#ifdef MSN_DEBUG_SLP slpmsg->info = "SLP DATA"; -#endif msn_slpmsg_set_image(slpmsg, img); msn_slplink_queue_slpmsg(slplink, slpmsg); purple_imgstore_unref(img); @@ -448,10 +438,8 @@ "\r\n"); g_free(header); -#ifdef MSN_DEBUG_SLP slpmsg->info = "SLP BYE"; slpmsg->text_body = TRUE; -#endif msn_slplink_queue_slpmsg(slplink, slpmsg); } @@ -619,10 +607,8 @@ "application/x-msnmsgr-transreqbody", content); -#ifdef MSN_DEBUG_SLP slpmsg->info = "SLP INVITE"; slpmsg->text_body = TRUE; -#endif msn_slplink_send_slpmsg(slplink, slpmsg); g_free(header); @@ -839,9 +825,8 @@ purple_conv_custom_smiley_write(conv, slpcall->data_info, data, size); purple_conv_custom_smiley_close(conv, slpcall->data_info ); } -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Got smiley: %s\n", slpcall->data_info); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "Got smiley: %s\n", slpcall->data_info); } void @@ -963,9 +948,8 @@ g_return_if_fail(userlist != NULL); -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Releasing buddy icon request\n"); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "Releasing buddy icon request\n"); if (userlist->buddy_icon_window > 0) { @@ -986,10 +970,10 @@ userlist->buddy_icon_window--; request_user_display(user); -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "msn_release_buddy_icon_request(): buddy_icon_window-- yields =%d\n", - userlist->buddy_icon_window); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", + "msn_release_buddy_icon_request(): buddy_icon_window-- yields =%d\n", + userlist->buddy_icon_window); } } @@ -1039,10 +1023,9 @@ userlist = user->userlist; queue = userlist->buddy_icon_requests; -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Queueing buddy icon request for %s (buddy_icon_window = %i)\n", - user->passport, userlist->buddy_icon_window); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "Queueing buddy icon request for %s (buddy_icon_window = %i)\n", + user->passport, userlist->buddy_icon_window); g_queue_push_tail(queue, user); @@ -1062,9 +1045,8 @@ g_return_if_fail(slpcall != NULL); info = slpcall->data_info; -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user); userlist = slpcall->slplink->session->userlist; account = slpcall->slplink->session->account; @@ -1090,9 +1072,8 @@ g_return_if_fail(session != NULL); -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "End User Display\n"); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "End User Display\n"); userlist = session->userlist; @@ -1150,9 +1131,8 @@ gconstpointer data = NULL; size_t len = 0; -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Requesting our own user display\n"); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "Requesting our own user display\n"); my_obj = msn_user_get_object(session->user); @@ -1168,10 +1148,9 @@ /* Free one window slot */ session->userlist->buddy_icon_window++; -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "request_user_display(): buddy_icon_window++ yields =%d\n", - session->userlist->buddy_icon_window); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "request_user_display(): buddy_icon_window++ yields =%d\n", + session->userlist->buddy_icon_window); msn_release_buddy_icon_request(session->userlist); }
--- a/libpurple/protocols/msn/slpcall.c Thu Jul 09 05:37:37 2009 +0000 +++ b/libpurple/protocols/msn/slpcall.c Fri Jul 10 00:51:31 2009 +0000 @@ -27,8 +27,6 @@ #include "slp.h" -/* #define MSN_DEBUG_SLPCALL */ - /************************************************************************** * Main **************************************************************************/ @@ -40,9 +38,8 @@ slpcall = data; -#ifdef MSN_DEBUG_SLPCALL - purple_debug_info("msn", "slpcall_timeout: slpcall(%p)\n", slpcall); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "slpcall_timeout: slpcall(%p)\n", slpcall); if (!slpcall->pending && !slpcall->progress) { @@ -64,9 +61,8 @@ slpcall = g_new0(MsnSlpCall, 1); -#ifdef MSN_DEBUG_SLPCALL - purple_debug_info("msn", "slpcall_new: slpcall(%p)\n", slpcall); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "slpcall_new: slpcall(%p)\n", slpcall); slpcall->slplink = slplink; @@ -82,9 +78,8 @@ { GList *e; -#ifdef MSN_DEBUG_SLPCALL - purple_debug_info("msn", "slpcall_destroy: slpcall(%p)\n", slpcall); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "slpcall_destroy: slpcall(%p)\n", slpcall); g_return_if_fail(slpcall != NULL); @@ -96,10 +91,9 @@ MsnSlpMessage *slpmsg = e->data; e = e->next; -#ifdef MSN_DEBUG_SLPCALL_VERBOSE - purple_debug_info("msn", "slpcall_destroy: trying slpmsg(%p)\n", - slpmsg); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "slpcall_destroy: trying slpmsg(%p)\n", + slpmsg); if (slpmsg->slpcall == slpcall) { @@ -173,10 +167,8 @@ slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, slpcall->branch, "application/x-msnmsgr-sessionreqbody", content); -#ifdef MSN_DEBUG_SLP slpmsg->info = "SLP INVITE"; slpmsg->text_body = TRUE; -#endif msn_slplink_send_slpmsg(slplink, slpmsg);
--- a/libpurple/protocols/msn/slpmsg.c Thu Jul 09 05:37:37 2009 +0000 +++ b/libpurple/protocols/msn/slpmsg.c Fri Jul 10 00:51:31 2009 +0000 @@ -36,9 +36,8 @@ slpmsg = g_new0(MsnSlpMessage, 1); -#ifdef MSN_DEBUG_SLPMSG - purple_debug_info("msn", "slpmsg new (%p)\n", slpmsg); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "slpmsg new (%p)\n", slpmsg); slpmsg->slplink = slplink; @@ -56,9 +55,8 @@ g_return_if_fail(slpmsg != NULL); -#ifdef MSN_DEBUG_SLPMSG - purple_debug_info("msn", "slpmsg destroy (%p)\n", slpmsg); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "slpmsg destroy (%p)\n", slpmsg); slplink = slpmsg->slplink; @@ -72,13 +70,6 @@ if (slpmsg->img == NULL) g_free(slpmsg->buffer); -#ifdef MSN_DEBUG_SLP - /* - if (slpmsg->info != NULL) - g_free(slpmsg->info); - */ -#endif - for (cur = slpmsg->msgs; cur != NULL; cur = cur->next) { /* Something is pointing to this slpmsg, so we should remove that @@ -87,10 +78,6 @@ MsnMessage *msg = cur->data; -#ifdef MSN_DEBUG_SLPMSG - purple_debug_info("msn", "Unlink slpmsg callbacks.\n"); -#endif - msg->ack_cb = NULL; msg->nak_cb = NULL; msg->ack_data = NULL; @@ -132,7 +119,6 @@ slpmsg->size = purple_imgstore_get_size(img); } -#ifdef MSN_DEBUG_SLP void msn_slpmsg_show(MsnMessage *msg) { @@ -161,7 +147,6 @@ msn_message_show_readable(msg, info, text); } -#endif MsnSlpMessage * msn_slpmsg_sip_new(MsnSlpCall *slpcall, int cseq,
--- a/libpurple/protocols/msn/slpmsg.h Thu Jul 09 05:37:37 2009 +0000 +++ b/libpurple/protocols/msn/slpmsg.h Fri Jul 10 00:51:31 2009 +0000 @@ -68,10 +68,8 @@ MsnMessage *msg; /**< The temporary real message that will be sent. */ #endif -#ifdef MSN_DEBUG_SLP - char *info; + const char *info; gboolean text_body; -#endif }; /** @@ -100,8 +98,6 @@ const char *content_type, const char *content); -#ifdef MSN_DEBUG_SLP void msn_slpmsg_show(MsnMessage *msg); -#endif #endif /* _MSN_SLPMSG_H_ */
--- a/libpurple/protocols/msn/switchboard.c Thu Jul 09 05:37:37 2009 +0000 +++ b/libpurple/protocols/msn/switchboard.c Fri Jul 10 00:51:31 2009 +0000 @@ -60,6 +60,9 @@ session->switches = g_list_prepend(session->switches, swboard); + if (purple_debug_is_verbose()) + purple_debug_info("msn", "switchboard new: swboard(%p)\n", swboard); + return swboard; } @@ -70,9 +73,8 @@ MsnMessage *msg; GList *l; -#ifdef MSN_DEBUG_SB - purple_debug_info("msn", "switchboard_destroy: swboard(%p)\n", swboard); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "switchboard destroy: swboard(%p)\n", swboard); g_return_if_fail(swboard != NULL); @@ -230,10 +232,9 @@ swboard->current_users++; swboard->empty = FALSE; -#ifdef MSN_DEBUG_CHAT - purple_debug_info("msn", "user=[%s], total=%d\n", user, - swboard->current_users); -#endif + if (purple_debug_is_verbose()) + purple_debug_info("msn", "user=[%s], total=%d\n", + user, swboard->current_users); if (!(swboard->flag & MSN_SB_FLAG_IM) && (swboard->conv != NULL)) { @@ -255,10 +256,6 @@ { GList *l; -#ifdef MSN_DEBUG_CHAT - purple_debug_info("msn", "[chat] Switching to chat.\n"); -#endif - #if 0 /* this is bad - it causes msn_switchboard_close to be called on the * switchboard we're in the middle of using :( */ @@ -278,18 +275,10 @@ tmp_user = l->data; -#ifdef MSN_DEBUG_CHAT - purple_debug_info("msn", "[chat] Adding [%s].\n", tmp_user); -#endif - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), tmp_user, NULL, PURPLE_CBFLAGS_NONE, TRUE); } -#ifdef MSN_DEBUG_CHAT - purple_debug_info("msn", "[chat] We add ourselves.\n"); -#endif - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), purple_account_get_username(account), NULL, PURPLE_CBFLAGS_NONE, TRUE); @@ -589,10 +578,10 @@ payload = msn_message_gen_payload(msg, &payload_len); -#ifdef MSN_DEBUG_SB - purple_debug_info("msn", "SB length:{%" G_GSIZE_FORMAT "}\n", payload_len); - msn_message_show_readable(msg, "SB SEND", FALSE); -#endif + if (purple_debug_is_verbose()) { + purple_debug_info("msn", "SB length:{%" G_GSIZE_FORMAT "}\n", payload_len); + msn_message_show_readable(msg, "SB SEND", FALSE); + } flag = msn_message_get_flag(msg); trans = msn_transaction_new(cmdproc, "MSG", "%c %" G_GSIZE_FORMAT, @@ -790,9 +779,8 @@ msn_message_parse_payload(msg, payload, len, MSG_LINE_DEM,MSG_BODY_DEM); -#ifdef MSN_DEBUG_SB - msn_message_show_readable(msg, "SB RECV", FALSE); -#endif + if (purple_debug_is_verbose()) + msn_message_show_readable(msg, "SB RECV", FALSE); g_free (msg->remote_user); msg->remote_user = g_strdup(cmd->params[0]);