pidgin: adf7d277: Convert the yahoo prpl to using the debu...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sat Jul 4 22:31:12 EDT 2009


-----------------------------------------------------------------
Revision: adf7d277ae63ff767e0db40965e3eee80cec5e46
Ancestor: cecad40e52a68c0c58412ba2771bee8decc909db
Author: rekkanoryo at pidgin.im
Date: 2009-07-05T02:23:43
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/adf7d277ae63ff767e0db40965e3eee80cec5e46

Modified files:
        libpurple/protocols/yahoo/util.c
        libpurple/protocols/yahoo/yahoo.c
        libpurple/protocols/yahoo/yahoo_filexfer.c
        libpurple/protocols/yahoo/yahoo_packet.c
        libpurple/protocols/yahoo/yahoochat.c
        libpurple/protocols/yahoo/ycht.c

ChangeLog: 

Convert the yahoo prpl to using the debug convenience functions instead of
purple_debug().

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/util.c	6c64eb439631d2315d139962e87ebd432c0fe023
+++ libpurple/protocols/yahoo/util.c	b195e8e7bfc48228be719ac13080d316e38b6760
@@ -354,7 +354,7 @@ char *yahoo_codes_to_html(const char *x)
 					else if ((match = (char *) g_hash_table_lookup(ht, tmp->str)))
 						g_string_append(s, match);
 					else {
-						purple_debug(PURPLE_DEBUG_ERROR, "yahoo",
+						purple_debug_error("yahoo",
 							"Unknown ansi code 'ESC[%sm'.\n", tmp->str);
 						g_string_free(tmp, TRUE);
 						break;
@@ -423,7 +423,7 @@ char *yahoo_codes_to_html(const char *x)
 
 	ret = s->str;
 	g_string_free(s, FALSE);
-	purple_debug(PURPLE_DEBUG_MISC, "yahoo", "yahoo_codes_to_html:  Returning string: '%s'.\n", ret);
+	purple_debug_misc("yahoo", "yahoo_codes_to_html:  Returning string: '%s'.\n", ret);
 	return ret;
 }
 
@@ -822,7 +822,7 @@ char *yahoo_html_to_codes(const char *sr
 	g_string_free(dest, FALSE);
 
 	esc = g_strescape(ret, NULL);
-	purple_debug(PURPLE_DEBUG_MISC, "yahoo", "yahoo_html_to_codes:  Returning string: '%s'.\n", esc);
+	purple_debug_misc("yahoo", "yahoo_html_to_codes:  Returning string: '%s'.\n", esc);
 	g_free(esc);
 
 	yahoo_htc_queue_cleanup(colors);
============================================================
--- libpurple/protocols/yahoo/yahoo.c	53f27387835d0b2e288e3ba30d14d71b38dbf092
+++ libpurple/protocols/yahoo/yahoo.c	6c0b138eb3730bdeb7c5da4b96d65a8ba9abfa07
@@ -390,7 +390,7 @@ static void yahoo_do_group_check(PurpleA
 		b = i->data;
 		g = purple_buddy_get_group(b);
 		if (!purple_utf8_strcasecmp(group, purple_group_get_name(g))) {
-			purple_debug(PURPLE_DEBUG_MISC, "yahoo",
+			purple_debug_misc("yahoo",
 				"Oh good, %s is in the right group (%s).\n", name, group);
 			list = g_slist_delete_link(list, i);
 			onlist = 1;
@@ -399,7 +399,7 @@ static void yahoo_do_group_check(PurpleA
 	}
 
 	if (!onlist) {
-		purple_debug(PURPLE_DEBUG_MISC, "yahoo",
+		purple_debug_misc("yahoo",
 			"Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group);
 		if (!(g = purple_find_group(group))) {
 			g = purple_group_new(group);
@@ -427,7 +427,7 @@ static void yahoo_do_group_cleanup(gpoin
 	for (i = list; i; i = i->next) {
 		b = i->data;
 		g = purple_buddy_get_group(b);
-		purple_debug(PURPLE_DEBUG_MISC, "yahoo", "Deleting Buddy %s from group %s.\n", name,
+		purple_debug_misc("yahoo", "Deleting Buddy %s from group %s.\n", name,
 				purple_group_get_name(g));
 		purple_blist_remove_buddy(b);
 	}
@@ -801,9 +801,8 @@ static void yahoo_process_notify(PurpleC
 		PurpleBuddy *bud = purple_find_buddy(account, from);
 
 		if (!bud) {
-			purple_debug(PURPLE_DEBUG_WARNING, "yahoo",
-					   "%s is playing a game, and doesn't want "
-					   "you to know.\n", from);
+			purple_debug_warning("yahoo",
+					   "%s is playing a game, and doesn't want you to know.\n", from);
 		}
 
 		f = yahoo_friend_find(gc, from);
@@ -1943,8 +1942,7 @@ static void ignore_buddy(PurpleBuddy *bu
 	name = g_strdup(purple_buddy_get_name(buddy));
 	account = purple_buddy_get_account(buddy);
 
-	purple_debug(PURPLE_DEBUG_INFO, "blist",
-		"Removing '%s' from buddy list.\n", name);
+	purple_debug_info("yahoo", "blist: Removing '%s' from buddy list.\n", name);
 	purple_account_remove_buddy(account, buddy, group);
 	purple_blist_remove_buddy(buddy);
 
@@ -2382,14 +2380,14 @@ static void yahoo_p2p_read_pkt_cb(gpoint
 	pos += 2;
 
 	pktlen = yahoo_get16(buf + pos); pos += 2;
-	purple_debug(PURPLE_DEBUG_MISC, "yahoo", "p2p: %d bytes to read\n", len);
+	purple_debug_misc("yahoo", "p2p: %d bytes to read\n", len);
 
 	pkt = yahoo_packet_new(0, 0, 0);
 	pkt->service = yahoo_get16(buf + pos); pos += 2;
 	pkt->status = yahoo_get32(buf + pos); pos += 4;
 	pkt->id = yahoo_get32(buf + pos); pos += 4;
 
-	purple_debug(PURPLE_DEBUG_MISC, "yahoo", "p2p: Yahoo Service: 0x%02x Status: %d\n",pkt->service, pkt->status);
+	purple_debug_misc("yahoo", "p2p: Yahoo Service: 0x%02x Status: %d\n",pkt->service, pkt->status);
 	yahoo_packet_read(pkt, buf + pos, pktlen);
 
 	/* packet processing */
@@ -2909,8 +2907,7 @@ static void yahoo_packet_process(PurpleC
 		break;
 
 	default:
-		purple_debug(PURPLE_DEBUG_ERROR, "yahoo",
-				   "Unhandled service 0x%02x\n", pkt->service);
+		purple_debug_error("yahoo", "Unhandled service 0x%02x\n", pkt->service);
 		break;
 	}
 }
@@ -2979,8 +2976,7 @@ static void yahoo_pending(gpointer data,
 		pos += 2;
 
 		pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2;
-		purple_debug(PURPLE_DEBUG_MISC, "yahoo",
-				   "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen);
+		purple_debug_misc("yahoo", "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen);
 
 		if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen))
 			return;
@@ -2991,8 +2987,7 @@ static void yahoo_pending(gpointer data,
 
 		pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2;
 		pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4;
-		purple_debug(PURPLE_DEBUG_MISC, "yahoo",
-				   "Yahoo Service: 0x%02x Status: %d\n",
+		purple_debug_misc("yahoo", "Yahoo Service: 0x%02x Status: %d\n",
 				   pkt->service, pkt->status);
 		pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4;
 
@@ -4882,8 +4877,7 @@ yahoopurple_cmd_chat_join(PurpleConversa
 	gc = purple_conversation_get_gc(conv);
 	yd = gc->proto_data;
 	id = yd->conf_id;
-	purple_debug(PURPLE_DEBUG_INFO, "yahoo",
-	           "Trying to join %s \n", args[0]);
+	purple_debug_info("yahoo", "Trying to join %s \n", args[0]);
 
 	comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
 	g_hash_table_replace(comp, g_strdup("room"), g_ascii_strdown(args[0], -1));
@@ -4920,8 +4914,8 @@ gboolean yahoo_send_attention(PurpleConn
 
 	g_return_val_if_fail(c != NULL, FALSE);
 
-	purple_debug(PURPLE_DEBUG_INFO, "yahoo",
-	           "Sending <ding> on account %s to buddy %s.\n", username, c->name);
+	purple_debug_info("yahoo", "Sending <ding> on account %s to buddy %s.\n",
+			username, c->name);
 	purple_conv_im_send_with_flags(PURPLE_CONV_IM(c), "<ding>", PURPLE_MESSAGE_INVISIBLE);
 
 	return TRUE;
============================================================
--- libpurple/protocols/yahoo/yahoo_filexfer.c	2a8b285b610c8f8ec805aaa65cfd4e07a1c15e33
+++ libpurple/protocols/yahoo/yahoo_filexfer.c	96d1ff8f66e6787e2a7cafab298ca78b5a0e7d0d
@@ -156,8 +156,8 @@ static void yahoo_receivefile_connected(
 	PurpleXfer *xfer;
 	struct yahoo_xfer_data *xd;
 
-	purple_debug(PURPLE_DEBUG_INFO, "yahoo",
-			   "AAA - in yahoo_receivefile_connected\n");
+	purple_debug_info("yahoo", "in yahoo_receivefile_connected\n");
+
 	if (!(xfer = data))
 		return;
 	if (!(xd = xfer->data))
@@ -235,8 +235,8 @@ static void yahoo_sendfile_connected(gpo
 	PurpleAccount *account;
 	struct yahoo_data *yd;
 
-	purple_debug(PURPLE_DEBUG_INFO, "yahoo",
-			   "AAA - in yahoo_sendfile_connected\n");
+	purple_debug_info("yahoo", "in yahoo_sendfile_connected\n");
+
 	if (!(xfer = data))
 		return;
 	if (!(xd = xfer->data))
============================================================
--- libpurple/protocols/yahoo/yahoo_packet.c	e88c5cc475ba3e0fb8e654138bbbf3aa7eebd469
+++ libpurple/protocols/yahoo/yahoo_packet.c	4858f07394b302535e0aa04d1f91875a0feb6201
@@ -190,8 +190,7 @@ void yahoo_packet_read(struct yahoo_pack
 			if (purple_debug_is_verbose()) {
 				char *esc;
 				esc = g_strescape(pair->value, NULL);
-				purple_debug(PURPLE_DEBUG_MISC, "yahoo",
-						   "Key: %d  \tValue: %s\n", pair->key, esc);
+				purple_debug_misc("yahoo", "Key: %d  \tValue: %s\n", pair->key, esc);
 				g_free(esc);
 			}
 		} else {
@@ -251,35 +250,35 @@ void yahoo_packet_dump(guchar *data, int
 #ifdef YAHOO_DEBUG
 	int i;
 
-	purple_debug(PURPLE_DEBUG_MISC, "yahoo", "");
+	purple_debug_misc("yahoo", "");
 
 	for (i = 0; i + 1 < len; i += 2) {
 		if ((i % 16 == 0) && i) {
-			purple_debug(PURPLE_DEBUG_MISC, NULL, "\n");
-			purple_debug(PURPLE_DEBUG_MISC, "yahoo", "");
+			purple_debug_misc(NULL, "\n");
+			purple_debug_misc("yahoo", "");
 		}
 
-		purple_debug(PURPLE_DEBUG_MISC, NULL, "%02x%02x ", data[i], data[i + 1]);
+		purple_debug_misc(NULL, "%02x%02x ", data[i], data[i + 1]);
 	}
 	if (i < len)
-		purple_debug(PURPLE_DEBUG_MISC, NULL, "%02x", data[i]);
+		purple_debug_misc(NULL, "%02x", data[i]);
 
-	purple_debug(PURPLE_DEBUG_MISC, NULL, "\n");
-	purple_debug(PURPLE_DEBUG_MISC, "yahoo", "");
+	purple_debug_misc(NULL, "\n");
+	purple_debug_misc("yahoo", "");
 
 	for (i = 0; i < len; i++) {
 		if ((i % 16 == 0) && i) {
-			purple_debug(PURPLE_DEBUG_MISC, NULL, "\n");
-			purple_debug(PURPLE_DEBUG_MISC, "yahoo", "");
+			purple_debug_misc(NULL, "\n");
+			purple_debug_misc("yahoo", "");
 		}
 
 		if (g_ascii_isprint(data[i]))
-			purple_debug(PURPLE_DEBUG_MISC, NULL, "%c ", data[i]);
+			purple_debug_misc(NULL, "%c ", data[i]);
 		else
-			purple_debug(PURPLE_DEBUG_MISC, NULL, ". ");
+			purple_debug_misc(NULL, ". ");
 	}
 
-	purple_debug(PURPLE_DEBUG_MISC, NULL, "\n");
+	purple_debug_misc(NULL, "\n");
 #endif /* YAHOO_DEBUG */
 }
 
============================================================
--- libpurple/protocols/yahoo/yahoochat.c	7101b40c76e3b988ea45b73f1f6c36e280201a3a
+++ libpurple/protocols/yahoo/yahoochat.c	92339ab598815cb5800119041d3bd56bf13a3f00
@@ -648,7 +648,7 @@ void yahoo_process_chat_message(PurpleCo
 	}
 
 	if (!msg) {
-		purple_debug(PURPLE_DEBUG_MISC, "yahoo", "Got a message packet with no message.\nThis probably means something important, but we're ignoring it.\n");
+		purple_debug_misc("yahoo", "Got a message packet with no message.\nThis probably means something important, but we're ignoring it.\n");
 		return;
 	}
 	msg2 = yahoo_string_decode(gc, msg, utf8);
============================================================
--- libpurple/protocols/yahoo/ycht.c	cc0c0c1fd9ba5f45f038e32c23e7ef2ee650ce0f
+++ libpurple/protocols/yahoo/ycht.c	4d48bacf406d1af0bcd523532682f05dffece5ed
@@ -196,35 +196,35 @@ static void ycht_packet_dump(const gucha
 #ifdef YAHOO_YCHT_DEBUG
 	int i;
 
-	purple_debug(PURPLE_DEBUG_MISC, "yahoo", "");
+	purple_debug_misc("yahoo", "");
 
 	for (i = 0; i + 1 < len; i += 2) {
 		if ((i % 16 == 0) && i) {
-			purple_debug(PURPLE_DEBUG_MISC, NULL, "\n");
-			purple_debug(PURPLE_DEBUG_MISC, "yahoo", "");
+			purple_debug_misc(NULL, "\n");
+			purple_debug_misc("yahoo", "");
 		}
 
-		purple_debug(PURPLE_DEBUG_MISC, NULL, "%02hhx%02hhx ", data[i], data[i + 1]);
+		purple_debug_misc(NULL, "%02hhx%02hhx ", data[i], data[i + 1]);
 	}
 	if (i < len)
-		purple_debug(PURPLE_DEBUG_MISC, NULL, "%02hhx", data[i]);
+		purple_debug_misc(NULL, "%02hhx", data[i]);
 
-	purple_debug(PURPLE_DEBUG_MISC, NULL, "\n");
-	purple_debug(PURPLE_DEBUG_MISC, "yahoo", "");
+	purple_debug_misc(NULL, "\n");
+	purple_debug_misc("yahoo", "");
 
 	for (i = 0; i < len; i++) {
 		if ((i % 16 == 0) && i) {
-			purple_debug(PURPLE_DEBUG_MISC, NULL, "\n");
-			purple_debug(PURPLE_DEBUG_MISC, "yahoo", "");
+			purple_debug_misc(NULL, "\n");
+			purple_debug_misc("yahoo", "");
 		}
 
 		if (g_ascii_isprint(data[i]))
-			purple_debug(PURPLE_DEBUG_MISC, NULL, "%c ", data[i]);
+			purple_debug_misc(NULL, "%c ", data[i]);
 		else
-			purple_debug(PURPLE_DEBUG_MISC, NULL, ". ");
+			purple_debug_misc(NULL, ". ");
 	}
 
-	purple_debug(PURPLE_DEBUG_MISC, NULL, "\n");
+	purple_debug_misc(NULL, "\n");
 #endif /* YAHOO_YCHT_DEBUG */
 }
 
@@ -507,16 +507,15 @@ static void ycht_pending(gpointer data, 
 		service = yahoo_get32(ycht->rxqueue + pos); pos += 4;
 		status = yahoo_get16(ycht->rxqueue + pos); pos += 2;
 		pktlen  = yahoo_get16(ycht->rxqueue + pos); pos += 2;
-		purple_debug(PURPLE_DEBUG_MISC, "yahoo",
-				   "ycht: %d bytes to read, rxlen is %d\n", pktlen, ycht->rxlen);
+		purple_debug_misc("yahoo", "ycht: %d bytes to read, rxlen is %d\n",
+				pktlen, ycht->rxlen);
 
 		if (ycht->rxlen < (YCHT_HEADER_LEN + pktlen))
 			return;
 
 		purple_debug_misc("yahoo", "--==Incoming YCHT packet==--\n");
-		purple_debug(PURPLE_DEBUG_MISC, "yahoo",
-			   "YCHT Service: 0x%02x Version: 0x%02x Status: 0x%02x\n",
-			   service, version, status);
+		purple_debug_misc("yahoo", "YCHT Service: 0x%02x Version: 0x%02x Status: 0x%02x\n",
+				service, version, status);
 		ycht_packet_dump(ycht->rxqueue, YCHT_HEADER_LEN + pktlen);
 
 		pkt = ycht_packet_new(version, service, status);


More information about the Commits mailing list