diff libpurple/protocols/qq/utils.c @ 23754:967344bc404d

applied changes from f12c8903079425d7850fa183df0b3f937b2952be through 8cebefbc6cd5d84acb69c74e69e8821f11dd225d Backport of 8cebefbc6cd5d84acb69c74e69e8821f11dd225d to avoid having other changes overwritten. 2008.08.16 - ccpaging <ecc_hy(at)hotmail.com> * Rename group to room. If you used pidginqq before, this may create a new room with same title, you may delete old one * Replace purple_debug with purple_debug_info, purple_debug_warning, purple_debug_error * Add server notice and server new, and two options to turn on/off * Minor modify for reducing transaction's debug infor * Minor modifies for system notice and QQ news. * Add 4 new strings need translate compare with p10. committer: Daniel Atallah <daniel.atallah@gmail.com>
author SHiNE CsyFeK <csyfek@gmail.com>
date Mon, 15 Sep 2008 02:59:23 +0000
parents 5f454b975a99
children bcfc98c7a55f
line wrap: on
line diff
--- a/libpurple/protocols/qq/utils.c	Sun Aug 10 04:32:14 2008 +0000
+++ b/libpurple/protocols/qq/utils.c	Mon Sep 15 02:59:23 2008 +0000
@@ -47,8 +47,8 @@
    struct sockaddr_in sin;
    socklen_t len = sizeof(sin);
    getsockname(fd, (struct sockaddr *)&sin, &len);
-   purple_debug(PURPLE_DEBUG_INFO, desc, "%s:%d\n",
-   inet_ntoa(sin.sin_addr), g_ntohs(sin.sin_port));
+   purple_debug_info(desc, "%s:%d\n",
+			inet_ntoa(sin.sin_addr), g_ntohs(sin.sin_port));
    }
    */
 
@@ -121,16 +121,16 @@
 	for (i = 0; segments[i] != NULL; i++) {;
 	}
 	if (i < expected_fields) {	/* not enough fields */
-		purple_debug(PURPLE_DEBUG_ERROR, "QQ",
-			   "Invalid data, expect %d fields, found only %d, discard\n", expected_fields, i);
+		purple_debug_error("QQ", "Invalid data, expect %d fields, found only %d, discard\n",
+				expected_fields, i);
 		g_strfreev(segments);
 		return NULL;
 	} else if (i > expected_fields) {	/* more fields, OK */
-		purple_debug(PURPLE_DEBUG_WARNING, "QQ",
-			   "Dangerous data, expect %d fields, found %d, return all\n", expected_fields, i);
+		purple_debug_warning("QQ", "Dangerous data, expect %d fields, found %d, return all\n",
+				expected_fields, i);
 		/* free up those not used */
 		for (j = expected_fields; j < i; j++) {
-			purple_debug(PURPLE_DEBUG_WARNING, "QQ", "field[%d] is %s\n", j, segments[j]);
+			purple_debug_warning("QQ", "field[%d] is %s\n", j, segments[j]);
 			g_free(segments[j]);
 		}
 
@@ -218,7 +218,7 @@
 	msg_utf8 = i < len ? qq_to_utf8((gchar *) &incoming[i], QQ_CHARSET_DEFAULT) : NULL;
 
 	if (msg_utf8 != NULL) {
-		purple_debug(PURPLE_DEBUG_WARNING, "QQ", "Try extract GB msg: %s\n", msg_utf8);
+		purple_debug_warning("QQ", "Try extract GB msg: %s\n", msg_utf8);
 	}
 	return msg_utf8;
 }
@@ -257,7 +257,7 @@
 	hex_buffer = strstrip(buffer);
 
 	if (strlen(hex_buffer) % 2 != 0) {
-		purple_debug(PURPLE_DEBUG_WARNING, "QQ",
+		purple_debug_warning("QQ",
 			"Unable to convert an odd number of nibbles to a string of bytes!\n");
 		g_free(hex_buffer);
 		return NULL;
@@ -272,8 +272,8 @@
 		} else if (g_ascii_isalpha(*cursor) && (gint) *cursor - 87 < 16) {
 			nibble1 = (gint) *cursor - 87;
 		} else {
-			purple_debug(PURPLE_DEBUG_WARNING, "QQ",
-				"Invalid char \'%c\' found in hex string!\n", *cursor);
+			purple_debug_warning("QQ", "Invalid char \'%c\' found in hex string!\n",
+					*cursor);
 			g_free(hex_str);
 			return NULL;
 		}
@@ -284,8 +284,7 @@
 		} else if (g_ascii_isalpha(*cursor) && (gint) (*cursor - 87) < 16) {
 			nibble2 = (gint) *cursor - 87;
 		} else {
-			purple_debug(PURPLE_DEBUG_WARNING, "QQ",
-				"Invalid char found in hex string!\n");
+			purple_debug_warning("QQ", "Invalid char found in hex string!\n");
 			g_free(hex_str);
 			return NULL;
 		}
@@ -362,22 +361,7 @@
 
 void qq_show_packet(const gchar *desc, const guint8 *buf, gint len)
 {
-	/*
-	   char buf1[8*len+2], buf2[10];
-	   int i;
-	   buf1[0] = 0;
-	   for (i = 0; i < len; i++) {
-	   sprintf(buf2, " %02x(%d)", buf[i] & 0xff, buf[i] & 0xff);
-	   strcat(buf1, buf2);
-	   }
-	   strcat(buf1, "\n");
-	   purple_debug(PURPLE_DEBUG_INFO, desc, "%s", buf1);
-	   */
-
-	/* modified by s3e, 20080424 */
-	qq_hex_dump(PURPLE_DEBUG_INFO, desc,
-		buf, len,
-		"");
+	qq_hex_dump(PURPLE_DEBUG_INFO, "QQ", buf, len, desc);
 }
 
 /* convert face num from packet (0-299) to local face (1-100) */