pidgin.2.4.3: 54416c3a: Sun Jun 29 22:00:12 CST 2008 csyfek at gma...

csyfek at gmail.com csyfek at gmail.com
Sun Jun 29 10:30:46 EDT 2008


-----------------------------------------------------------------
Revision: 54416c3a9ed80862d700c73b4a62bffe02e23534
Ancestor: a6a8a0f2b45006944916446be22cb8e56f0fca3f
Author: csyfek at gmail.com
Date: 2008-06-29T14:24:21
Branch: im.pidgin.pidgin.2.4.3
URL: http://d.pidgin.im/viewmtn/revision/info/54416c3a9ed80862d700c73b4a62bffe02e23534

Modified files:
        libpurple/protocols/qq/AUTHORS
        libpurple/protocols/qq/ChangeLog
        libpurple/protocols/qq/buddy_list.c
        libpurple/protocols/qq/buddy_list.h
        libpurple/protocols/qq/char_conv.c
        libpurple/protocols/qq/group_info.c
        libpurple/protocols/qq/group_internal.c
        libpurple/protocols/qq/im.c
        libpurple/protocols/qq/qq_network.c
        libpurple/protocols/qq/utils.c

ChangeLog: 

Sun Jun 29 22:00:12 CST 2008  csyfek at gmail.com
  * 20080629-fixed-qun-processing
  Merged patches from moo, ccpaging and coly
  
  Tickets:
  References #6199
Sat Jun 28 13:25:40 CST 2008  csyfek at gmail.com
  * 20080628-get-friends
  Patches from moo and ccpaging.
  
  Tickets:
  Fixes #4956.
  Fixes #2998.

-------------- next part --------------
============================================================
--- libpurple/protocols/qq/AUTHORS	84139ec9be35041b9055a503e8c53fde141a72f7
+++ libpurple/protocols/qq/AUTHORS	a7cd1db3e79e2eb577c783c684bd54061553c4cc
@@ -9,11 +9,27 @@ lvxiang     : provided ip to location or
 rakescar    : provided filter for HTML tag
 yyw         : improved performance on PPC linux
 lvxiang     : provided ip to location original code
-csyfek      : faces
 markhuetsch : OpenQ merge into libpurple, maintainer 2006-2007
+ccpaging    : maintainer since 2007
+icesky      : maintainer since 2007
+csyfek      : faces, maintainer since 2007
 
+Lovely Patch Writers
+=====
+Gnap.An     : message displaying, documentation
+manphiz     : qun processing
+moo         : qun processing
+Coly Li     : qun processing
+
 Acknowledgement
 =====
 Shufeng Tan : http://sf.net/projects/perl-oicq
 Jeff Ye     : http://www.sinomac.com
 Hu Zheng    : http://forlinux.yeah.net
+yunfan      : http://www.myswear.net
+khc at pidgin.im
+qulogic at pidgin.im
+rlaager at pidgin.im
+OpenQ Team
+LumaQQ Team
+OpenQ at GoogleGroup
============================================================
--- libpurple/protocols/qq/ChangeLog	00098aecec67a7c79feb8f74898b88d600da9a33
+++ libpurple/protocols/qq/ChangeLog	eb16c476d9e3f03d5c027d23ffb00027c0cf33b7
@@ -1,3 +1,14 @@
+2008.06.29 - csyfek <csyfek(at)gmail.com>
+	* Minor bug fix
+	* Add some doxygen syntax for preparing development documentation
+	* References #6199
+
+2008.06.28 - ccpaging <ecc_hy(at)hotmail.com>, moo <phpxcache(at)gmail.com>
+	* Patches from moo<phpxcache at gmail.com> and ccpaging<ccpaging at foxmail.com>.
+	* Tickets:
+	* Fixes #4956.
+	* Fixes #2998.
+
 2008.06.07 - ccpaging <ecc_hy(at)hotmail.com>, csyfek <csyfek(at)gmail.com>
 	* Clean code and apply patches from QuLogic
 
============================================================
--- libpurple/protocols/qq/buddy_list.c	5a74ee6ca079793e853a137df42d507aa9897523
+++ libpurple/protocols/qq/buddy_list.c	2947ad8ba369c38260acf0225e1a10c6114acdc8
@@ -147,6 +147,7 @@ void qq_process_get_buddies_online_reply
 {
 	qq_data *qd;
 	gint len, bytes, bytes_buddy;
+	gint count;
 	guint8 *data, position;
 	PurpleBuddy *b;
 	qq_buddy *q_bud;
@@ -173,6 +174,7 @@ void qq_process_get_buddies_online_reply
 	fe = g_newa(qq_friends_online_entry, 1);
 	fe->s = g_newa(qq_buddy_status, 1);
 
+	count = 0;
 	while (bytes < len) {
 		/* set flag */
 		bytes_buddy = bytes;
@@ -217,6 +219,7 @@ void qq_process_get_buddies_online_reply
 			q_bud->flag1 = fe->flag1;
 			q_bud->comm_flag = fe->comm_flag;
 			qq_update_buddy_contact(gc, q_bud);
+			count++;
 		} else {
 			purple_debug(PURPLE_DEBUG_ERROR, "QQ", 
 					"Got an online buddy %d, but not in my buddy list\n", fe->s->uid);
@@ -232,10 +235,14 @@ void qq_process_get_buddies_online_reply
 	}
 
 	if (position != QQ_FRIENDS_ONLINE_POSITION_END) {
-		purple_debug(PURPLE_DEBUG_INFO, "QQ", "Has more online buddies, position from %d\n", position);
-
+		purple_debug(PURPLE_DEBUG_INFO, "QQ", "Received %d online buddies, nextposition=%u\n",
+								count, (guint) position);
+		if (position != QQ_FRIENDS_ONLINE_POSITION_START) {
+			purple_debug(PURPLE_DEBUG_INFO, "QQ", "Requesting for more online buddies\n"); 
+		}
 		qq_send_packet_get_buddies_online(gc, position);
 	} else {
+		purple_debug(PURPLE_DEBUG_INFO, "QQ", "All online buddies received\n"); 
 		qq_send_packet_get_buddies_levels(gc);
 		qq_refresh_all_buddy_status(gc);
 	}
@@ -247,7 +254,7 @@ void qq_process_get_buddies_list_reply(g
 {
 	qq_data *qd;
 	qq_buddy *q_bud;
-	gint len, bytes_expected, i;
+	gint len, bytes_expected, count;
 	gint bytes, buddy_bytes;
 	guint16 position, unknown;
 	guint8 *data, pascal_len;
@@ -267,7 +274,7 @@ void qq_process_get_buddies_list_reply(g
 	bytes = 0;
 	bytes += qq_get16(&position, data + bytes);
 	/* the following data is buddy list in this packet */
-	i = 0;
+	count = 0;
 	while (bytes < len) {
 		q_bud = g_new0(qq_buddy, 1);
 		/* set flag */
@@ -306,7 +313,7 @@ void qq_process_get_buddies_list_reply(g
 			g_free(q_bud);
 			continue;
 		} else {
-			i++;
+			count++;
 		}
 
 		if (QQ_DEBUG) {
@@ -332,11 +339,16 @@ void qq_process_get_buddies_list_reply(g
 		purple_debug(PURPLE_DEBUG_ERROR, "QQ", 
 				"qq_process_get_buddies_list_reply: Dangerous error! maybe protocol changed, notify developers!");
 	}
-	if (position == QQ_FRIENDS_LIST_POSITION_END) {
-		purple_debug(PURPLE_DEBUG_INFO, "QQ", "Get friends list done, %d buddies\n", i);
-		qq_send_packet_get_buddies_online(gc, QQ_FRIENDS_ONLINE_POSITION_START);
+
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "Received %d buddies, nextposition=%u\n",
+		count, (guint) position);
+	if (position != QQ_FRIENDS_LIST_POSITION_START
+		&& position != QQ_FRIENDS_LIST_POSITION_END) { 
+		purple_debug(PURPLE_DEBUG_INFO, "QQ", "Requesting for more buddies\n"); 
+		qq_send_packet_get_buddies_list(gc, position);
 	} else {
-		qq_send_packet_get_buddies_list(gc, position);
+		purple_debug(PURPLE_DEBUG_INFO, "QQ", "All buddies received. Requesting for online buddies list\n");
+		qq_send_packet_get_buddies_online(gc, QQ_FRIENDS_LIST_POSITION_START); 
 	}
 }
 
@@ -419,4 +431,11 @@ void qq_process_get_all_list_with_group_
 	}
 
 	purple_debug(PURPLE_DEBUG_INFO, "QQ", "Get all list done, %d buddies and %d Quns\n", i, j);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "Received %d buddies and %d groups, nextposition=%u\n", i, j, (guint) position);
+	if (position != QQ_FRIENDS_ALL_LIST_POSITION_START && position != QQ_FRIENDS_ALL_LIST_POSITION_START) {
+		purple_debug(PURPLE_DEBUG_INFO, "QQ", "Requesting for more buddies and groups\n");
+		qq_send_packet_get_all_list_with_group(gc, position);
+	} else {
+		purple_debug(PURPLE_DEBUG_INFO, "QQ", "All buddies and groups received\n"); 
+	}
 }
============================================================
--- libpurple/protocols/qq/buddy_list.h	102f3cf0cfc265286aa3dc8a726ee0b13f0520a9
+++ libpurple/protocols/qq/buddy_list.h	2a72afb23291c4bdb83877f7e76f14ecc4fb96ee
@@ -32,6 +32,8 @@
 #define QQ_FRIENDS_LIST_POSITION_END 		0xffff
 #define QQ_FRIENDS_ONLINE_POSITION_START 	0x00
 #define QQ_FRIENDS_ONLINE_POSITION_END 		0xff
+#define QQ_FRIENDS_ALL_LIST_POSITION_START  0x00000000
+#define QQ_FRIENDS_ALL_LIST_POSITION_END  0xffffffff
 
 void qq_send_packet_get_buddies_online(PurpleConnection *gc, guint8 position);
 void qq_process_get_buddies_online_reply(guint8 *buf, gint buf_len, PurpleConnection *gc);
============================================================
--- libpurple/protocols/qq/char_conv.c	c9333306d49303892a75c85fe7f0b536642e49a4
+++ libpurple/protocols/qq/char_conv.c	ac1eabef8b90f8a8f84bf1e685c04552a9172c37
@@ -123,9 +123,14 @@ static gchar *_my_convert(const gchar *s
 	return g_strdup(QQ_NULL_MSG);
 }
 
-/* take the input as a pascal string and return a converted c-string in UTF-8
+/**
+ * @brief 把输入作为一个pascal字符串并返回一个用UFT-8转换的c-字符串.\n
+ * 返回已读入的字节数,或者当遇到错误时返回-1.该完成转换的UTF-8字符串被保存到ret中
+ *
+ * take the input as a pascal string and return a converted c-string in UTF-8
  * returns the number of bytes read, return -1 if fatal error
- * the converted UTF-8 will be saved in ret */
+ * the converted UTF-8 will be saved in ret
+ */ 
 gint convert_as_pascal_string(guint8 *data, gchar **ret, const gchar *from_charset) 
 {
 	guint8 len;
============================================================
--- libpurple/protocols/qq/group_info.c	8f6b83ac2d45dfc944ab475e9bee4d26917239c4
+++ libpurple/protocols/qq/group_info.c	fb1b7bc15297840b41f1c1e120e2b3dd4788c5ab
@@ -141,6 +141,9 @@ void qq_send_cmd_group_get_members_info(
 	qq_send_group_cmd(gc, group, raw_data, bytes);
 }
 
+/**
+ * @brief 处理群信息.当前群信息的处理还不完善,由于版本的不同导致协议的解读有差异.
+ */
 void qq_process_group_cmd_get_group_info(guint8 *data, gint len, PurpleConnection *gc)
 {
 	qq_group *group;
@@ -163,7 +166,7 @@ void qq_process_group_cmd_get_group_info
 	g_return_if_fail(internal_group_id > 0);
 
 	bytes += qq_get32(&(external_group_id), data + bytes);
-	g_return_if_fail(internal_group_id > 0);
+	g_return_if_fail(external_group_id > 0);
 
 	pending_id = qq_get_pending_id(qd->adding_groups_from_server, internal_group_id);
 	if (pending_id != NULL) {
@@ -183,13 +186,24 @@ void qq_process_group_cmd_get_group_info
 	bytes += qq_get32(&(group->group_category), data + bytes);
 	bytes += qq_get16(&max_members, data + bytes);
 	bytes += qq_get8(&unknown1, data + bytes);
-	bytes += qq_get32(&(unknown4), data + bytes);	/* versionID */
-
+	/* XXX
+	 * the following, while Eva:
+	 * 4(unk), 4(verID), 1(nameLen), nameLen(qunNameContent), 1(0x00),
+	 * 2(qunNoticeLen), qunNoticeLen(qunNoticeContent, 1(qunDescLen),
+	 * qunDestLen(qunDestcontent)) */
+	bytes += qq_get8(&unknown1, data + bytes);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "type=%u creatorid=%u category=%u\n",
+			group->group_type, group->creator_uid, group->group_category);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "maxmembers=%u", max_members); 
+	
 	/* strlen + <str content> */
 	bytes += convert_as_pascal_string(data + bytes, &(group->group_name_utf8), QQ_CHARSET_DEFAULT);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "group \"%s\"\n", group->group_name_utf8); 
 	bytes += qq_get16(&unknown, data + bytes);	/* 0x0000 */
 	bytes += convert_as_pascal_string(data + bytes, &(group->notice_utf8), QQ_CHARSET_DEFAULT);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "notice \"%s\"\n", group->notice_utf8); 
 	bytes += convert_as_pascal_string(data + bytes, &(group->group_desc_utf8), QQ_CHARSET_DEFAULT);
+	purple_debug(PURPLE_DEBUG_INFO, "QQ", "group_desc \"%s\"\n", group->group_desc_utf8); 
 
 	num = 0;
 	/* now comes the member list separated by 0x00 */
============================================================
--- libpurple/protocols/qq/group_internal.c	7557c6350e61dd1dc126cacd99c232e4bd820d8a
+++ libpurple/protocols/qq/group_internal.c	ec87192a0c342c45a2add0075f5db38309f48b50
@@ -230,7 +230,9 @@ void qq_set_pending_id(GSList **list, gu
 		*list = g_slist_remove(*list, GINT_TO_POINTER(id));
 }
 
-/* Return the location of id in list, or NULL if not found */
+/**
+ * @brief Return the location of id in list, or NULL if not found (返回id在链表中的位置,没有找到则返回NULL)
+ */
 GSList *qq_get_pending_id(GSList *list, guint32 id)
 {
         return g_slist_find(list, GINT_TO_POINTER(id));
============================================================
--- libpurple/protocols/qq/im.c	e0de1b7f4c8b8b66f0d4193fc0b5071f409b22bc
+++ libpurple/protocols/qq/im.c	d8305a7e2561f666f2f8e7f594d8e70786ab255c
@@ -384,8 +384,9 @@ static void _qq_process_recv_normal_im(g
 			im_unprocessed->length = len - bytes;
 			/* a simple process here, maybe more later */
 			purple_debug (PURPLE_DEBUG_WARNING, "QQ",
-					"Normal IM, unprocessed type [0x%04x], unknown [0x%02x], len %d\n",
-					common->normal_im_type, im_unprocessed->unknown, im_unprocessed->length);
+					"Normal IM, unprocessed type [0x%04x], len %d\n",
+					common->normal_im_type, im_unprocessed->length);
+			qq_show_packet ("QQ unk-im", im_unprocessed->unknown, im_unprocessed->length);
 			g_free (common->session_md5);
 			return;
 	}
============================================================
--- libpurple/protocols/qq/qq_network.c	58de8478d42cd07d5cbea9ef6c44edea10f37ed2
+++ libpurple/protocols/qq/qq_network.c	4ddd81310ea1c6ad22702fc19e5b75d74a58d293
@@ -933,7 +933,7 @@ static void udp_host_resolved(GSList *ho
 			return;
 		}
 
-	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Connection failed: %d\n", g_strerror(errno));
+	purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Connection failed: %s\n", g_strerror(errno));
 	close(fd);
 }
 
============================================================
--- libpurple/protocols/qq/utils.c	6551e63eec5a6b5658004e318ffadf5c036f8fca
+++ libpurple/protocols/qq/utils.c	c1a41cb28f8fc57805e23c4bf2edcaa2ef9d8bac
@@ -293,12 +293,12 @@ static gchar *hex_dump_to_str(const guin
 	str = g_string_new("");
 	for (i = 0; i < bytes; i += 16) {
 		/* length label */
-		g_string_append_printf(str, "%04d: ", i);
+		g_string_append_printf(str, "%07x: ", i);
 
 		/* dump hex value */
 		for (j = 0; j < 16; j++)
 			if ((i + j) < bytes)
-				g_string_append_printf(str, " %02X", buffer[i + j]);
+				g_string_append_printf(str, " %02x", buffer[i + j]);
 			else
 				g_string_append(str, "   ");
 		g_string_append(str, "  ");


More information about the Commits mailing list