Mercurial > pidgin
changeset 23052:ebad75b719f5
Sun Jun 29 22:00:12 CST 2008 csyfek@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@gmail.com
* 20080628-get-friends
Patches from moo and ccpaging.
Tickets:
Fixes #4956.
Fixes #2998.
author | SHiNE CsyFeK <csyfek@gmail.com> |
---|---|
date | Sun, 29 Jun 2008 14:24:21 +0000 |
parents | 55f986ccbb6a |
children | 0830ab50c463 |
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 |
diffstat | 10 files changed, 91 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/qq/AUTHORS Tue Jun 24 12:28:38 2008 +0000 +++ b/libpurple/protocols/qq/AUTHORS Sun Jun 29 14:24:21 2008 +0000 @@ -9,11 +9,27 @@ 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@pidgin.im +qulogic@pidgin.im +rlaager@pidgin.im +OpenQ Team +LumaQQ Team +OpenQ@GoogleGroup
--- a/libpurple/protocols/qq/ChangeLog Tue Jun 24 12:28:38 2008 +0000 +++ b/libpurple/protocols/qq/ChangeLog Sun Jun 29 14:24:21 2008 +0000 @@ -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@gmail.com> and ccpaging<ccpaging@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
--- a/libpurple/protocols/qq/buddy_list.c Tue Jun 24 12:28:38 2008 +0000 +++ b/libpurple/protocols/qq/buddy_list.c Sun Jun 29 14:24:21 2008 +0000 @@ -147,6 +147,7 @@ { qq_data *qd; gint len, bytes, bytes_buddy; + gint count; guint8 *data, position; PurpleBuddy *b; qq_buddy *q_bud; @@ -173,6 +174,7 @@ 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 @@ 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 @@ } 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 @@ { 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 @@ 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 @@ g_free(q_bud); continue; } else { - i++; + count++; } if (QQ_DEBUG) { @@ -332,11 +339,16 @@ 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 @@ } 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"); + } }
--- a/libpurple/protocols/qq/buddy_list.h Tue Jun 24 12:28:38 2008 +0000 +++ b/libpurple/protocols/qq/buddy_list.h Sun Jun 29 14:24:21 2008 +0000 @@ -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);
--- a/libpurple/protocols/qq/char_conv.c Tue Jun 24 12:28:38 2008 +0000 +++ b/libpurple/protocols/qq/char_conv.c Sun Jun 29 14:24:21 2008 +0000 @@ -123,9 +123,14 @@ 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;
--- a/libpurple/protocols/qq/group_info.c Tue Jun 24 12:28:38 2008 +0000 +++ b/libpurple/protocols/qq/group_info.c Sun Jun 29 14:24:21 2008 +0000 @@ -141,6 +141,9 @@ 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 @@ 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 @@ 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 */
--- a/libpurple/protocols/qq/group_internal.c Tue Jun 24 12:28:38 2008 +0000 +++ b/libpurple/protocols/qq/group_internal.c Sun Jun 29 14:24:21 2008 +0000 @@ -230,7 +230,9 @@ *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));
--- a/libpurple/protocols/qq/im.c Tue Jun 24 12:28:38 2008 +0000 +++ b/libpurple/protocols/qq/im.c Sun Jun 29 14:24:21 2008 +0000 @@ -384,8 +384,9 @@ 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; }
--- a/libpurple/protocols/qq/qq_network.c Tue Jun 24 12:28:38 2008 +0000 +++ b/libpurple/protocols/qq/qq_network.c Sun Jun 29 14:24:21 2008 +0000 @@ -933,7 +933,7 @@ 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); }
--- a/libpurple/protocols/qq/utils.c Tue Jun 24 12:28:38 2008 +0000 +++ b/libpurple/protocols/qq/utils.c Sun Jun 29 14:24:21 2008 +0000 @@ -293,12 +293,12 @@ 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, " ");