annotate src/protocols/qq/group_info.c @ 14058:32a71e64ceae

[gaim-migrate @ 16673] Eliminated a number of warnings. Generally, this consisted of fixing incorrectly declared data types and adding a few casts. I also moved some declarations that occurred in the middle of code. Minor formatting changes. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Tue, 08 Aug 2006 23:20:08 +0000
parents ef8490f9e823
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
1 /**
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
2 * The QQ2003C protocol plugin
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
3 *
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
4 * for gaim
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
5 *
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
6 * Copyright (C) 2004 Puzzlebird
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
7 *
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
11 * (at your option) any later version.
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
12 *
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
16 * GNU General Public License for more details.
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
17 *
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
21 */
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
22
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
23 #include "conversation.h"
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
24 #include "debug.h"
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
25
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
26 #include "buddy_status.h"
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
27 #include "char_conv.h"
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
28 #include "group_find.h"
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
29 #include "group_hash.h"
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
30 #include "group_info.h"
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
31 #include "buddy_status.h"
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
32 #include "group_network.h"
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
33
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
34 /* we check who needs to update member info every minutes
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
35 * this interval determines if their member info is outdated */
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
36 #define QQ_GROUP_CHAT_REFRESH_NICKNAME_INTERNAL 180
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
37
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
38 static gboolean _is_group_member_need_update_info(qq_buddy *member)
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
39 {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
40 g_return_val_if_fail(member != NULL, FALSE);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
41 return (member->nickname == NULL) ||
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
42 (time(NULL) - member->last_refresh) > QQ_GROUP_CHAT_REFRESH_NICKNAME_INTERNAL;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
43 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
44
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
45 /* this is done when we receive the reply to get_online_member sub_cmd
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
46 * all member are set offline, and then only those in reply packets are online */
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
47 static void _qq_group_set_members_all_offline(qq_group *group)
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
48 {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
49 GList *list;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
50 qq_buddy *member;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
51 g_return_if_fail(group != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
52
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
53 list = group->members;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
54 while (list != NULL) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
55 member = (qq_buddy *) list->data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
56 member->status = QQ_BUDDY_ONLINE_OFFLINE;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
57 list = list->next;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
58 }
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
59 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
60
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
61 /* send packet to get detailed information of one group */
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
62 void qq_send_cmd_group_get_group_info(GaimConnection *gc, qq_group *group)
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
63 {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
64 guint8 *raw_data, *cursor;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
65 gint bytes, data_len;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
66
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
67 g_return_if_fail(gc != NULL && group != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
68
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
69 data_len = 5;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
70 raw_data = g_newa(guint8, data_len);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
71 cursor = raw_data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
72
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
73 bytes = 0;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
74 bytes += create_packet_b(raw_data, &cursor, QQ_GROUP_CMD_GET_GROUP_INFO);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
75 bytes += create_packet_dw(raw_data, &cursor, group->internal_group_id);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
76
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
77 if (bytes != data_len)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
78 gaim_debug(GAIM_DEBUG_ERROR, "QQ",
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
79 "Fail create packet for %s\n", qq_group_cmd_get_desc(QQ_GROUP_CMD_GET_GROUP_INFO));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
80 else
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
81 qq_send_group_cmd(gc, group, raw_data, data_len);
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
82 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
83
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
84 /* send packet to get online group member, called by keep_alive */
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
85 void qq_send_cmd_group_get_online_member(GaimConnection *gc, qq_group *group)
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
86 {
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
87 guint8 *raw_data, *cursor;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
88 gint bytes, data_len;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
89
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
90 g_return_if_fail(gc != NULL && group != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
91
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
92 /* only get online members when conversation window is on */
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
93 if (NULL == gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT,group->group_name_utf8, gaim_connection_get_account(gc))) {
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
94 gaim_debug(GAIM_DEBUG_WARNING, "QQ",
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
95 "Conv windows for \"%s\" is not on, do not get online members\n", group->group_name_utf8);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
96 return;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
97 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
98
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
99 data_len = 5;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
100 raw_data = g_newa(guint8, data_len);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
101 cursor = raw_data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
102
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
103 bytes = 0;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
104 bytes += create_packet_b(raw_data, &cursor, QQ_GROUP_CMD_GET_ONLINE_MEMBER);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
105 bytes += create_packet_dw(raw_data, &cursor, group->internal_group_id);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
106
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
107 if (bytes != data_len)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
108 gaim_debug(GAIM_DEBUG_ERROR, "QQ",
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
109 "Fail create packet for %s\n", qq_group_cmd_get_desc(QQ_GROUP_CMD_GET_ONLINE_MEMBER));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
110 else
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
111 qq_send_group_cmd(gc, group, raw_data, data_len);
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
112 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
113
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
114 /* send packet to get group member info */
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
115 void qq_send_cmd_group_get_member_info(GaimConnection *gc, qq_group *group)
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
116 {
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
117 guint8 *raw_data, *cursor;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
118 gint bytes, data_len, i;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
119 GList *list;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
120 qq_buddy *member;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
121
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
122 g_return_if_fail(gc != NULL && group != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
123 for (i = 0, list = group->members; list != NULL; list = list->next) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
124 member = (qq_buddy *) list->data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
125 if (_is_group_member_need_update_info(member))
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
126 i++;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
127 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
128
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
129 if (i <= 0) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
130 gaim_debug(GAIM_DEBUG_INFO, "QQ", "No group member needs to to update info now.\n");
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
131 return;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
132 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
133
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
134 data_len = 5 + 4 * i;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
135 raw_data = g_newa(guint8, data_len);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
136 cursor = raw_data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
137
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
138 bytes = 0;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
139 bytes += create_packet_b(raw_data, &cursor, QQ_GROUP_CMD_GET_MEMBER_INFO);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
140 bytes += create_packet_dw(raw_data, &cursor, group->internal_group_id);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
141
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
142 list = group->members;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
143 while (list != NULL) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
144 member = (qq_buddy *) list->data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
145 if (_is_group_member_need_update_info(member))
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
146 bytes += create_packet_dw(raw_data, &cursor, member->uid);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
147 list = list->next;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
148 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
149
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
150 if (bytes != data_len)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
151 gaim_debug(GAIM_DEBUG_ERROR, "QQ",
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
152 "Fail create packet for %s\n", qq_group_cmd_get_desc(QQ_GROUP_CMD_GET_MEMBER_INFO));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
153 else
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
154 qq_send_group_cmd(gc, group, raw_data, data_len);
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
155 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
156
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
157 void qq_process_group_cmd_get_group_info(guint8 *data, guint8 **cursor, gint len, GaimConnection *gc)
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
158 {
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
159 qq_group *group;
14058
32a71e64ceae [gaim-migrate @ 16673]
Mark Huetsch <markhuetsch>
parents: 14021
diff changeset
160 qq_buddy *member;
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
161 qq_data *qd;
14058
32a71e64ceae [gaim-migrate @ 16673]
Mark Huetsch <markhuetsch>
parents: 14021
diff changeset
162 GaimConversation *gaim_conv;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
163 guint8 orgnization, role;
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
164 guint16 unknown;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
165 guint32 member_uid, internal_group_id;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
166 gint pascal_len, i;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
167 guint32 unknown4;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
168 guint8 unknown1;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
169
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
170 g_return_if_fail(gc != NULL && gc->proto_data != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
171 g_return_if_fail(data != NULL && len > 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
172 qd = (qq_data *) gc->proto_data;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
173
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
174 read_packet_dw(data, cursor, len, &(internal_group_id));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
175 g_return_if_fail(internal_group_id > 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
176
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
177 group = qq_group_find_by_internal_group_id(gc, internal_group_id);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
178 g_return_if_fail(group != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
179
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
180 read_packet_dw(data, cursor, len, &(group->external_group_id));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
181 read_packet_b(data, cursor, len, &(group->group_type));
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
182 read_packet_dw(data, cursor, len, &unknown4); /* unknown 4 bytes */
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
183 read_packet_dw(data, cursor, len, &(group->creator_uid));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
184 read_packet_b(data, cursor, len, &(group->auth_type));
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
185 read_packet_dw(data, cursor, len, &unknown4); /* oldCategory */
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
186 read_packet_w(data, cursor, len, &unknown);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
187 read_packet_dw(data, cursor, len, &(group->group_category));
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
188 read_packet_w(data, cursor, len, &(unknown)); /* 0x0000 */
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
189 read_packet_b(data, cursor, len, &unknown1);
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
190 read_packet_dw(data, cursor, len, &(unknown4)); /* versionID */
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
191
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
192 pascal_len = convert_as_pascal_string(*cursor, &(group->group_name_utf8), QQ_CHARSET_DEFAULT);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
193 *cursor += pascal_len;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
194 read_packet_w(data, cursor, len, &(unknown)); /* 0x0000 */
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
195 pascal_len = convert_as_pascal_string(*cursor, &(group->notice_utf8), QQ_CHARSET_DEFAULT);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
196 *cursor += pascal_len;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
197 pascal_len = convert_as_pascal_string(*cursor, &(group->group_desc_utf8), QQ_CHARSET_DEFAULT);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
198 *cursor += pascal_len;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
199
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
200 i = 0;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
201 /* now comes the member list separated by 0x00 */
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
202 while (*cursor < data + len) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
203 read_packet_dw(data, cursor, len, &member_uid);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
204 i++;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
205 read_packet_b(data, cursor, len, &orgnization);
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
206 read_packet_b(data, cursor, len, &role);
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
207
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
208 if(orgnization != 0 || role != 0) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
209 gaim_debug(GAIM_DEBUG_INFO, "QQ", "group member %d: orgnizatio=%d, role=%d\n", member_uid, orgnization, role);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
210 }
14058
32a71e64ceae [gaim-migrate @ 16673]
Mark Huetsch <markhuetsch>
parents: 14021
diff changeset
211 member = qq_group_find_or_add_member(gc, group, member_uid);
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
212 member->role = role;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
213 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
214 if(*cursor > (data + len)) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
215 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "group_cmd_get_group_info: Dangerous error! maybe protocal changed, notify me!");
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
216 }
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
217
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
218 gaim_debug(GAIM_DEBUG_INFO, "QQ", "group \"%s\" has %d members\n", group->group_name_utf8, i);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
219
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
220 if (group->creator_uid == qd->uid)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
221 group->my_status = QQ_GROUP_MEMBER_STATUS_IS_ADMIN;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
222
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
223 qq_group_refresh(gc, group);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
224
14058
32a71e64ceae [gaim-migrate @ 16673]
Mark Huetsch <markhuetsch>
parents: 14021
diff changeset
225 gaim_conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT,
32a71e64ceae [gaim-migrate @ 16673]
Mark Huetsch <markhuetsch>
parents: 14021
diff changeset
226 group->group_name_utf8, gaim_connection_get_account(gc));
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
227 if(NULL == gaim_conv) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
228 gaim_debug(GAIM_DEBUG_WARNING, "QQ",
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
229 "Conv windows for \"%s\" is not on, do not set topic\n", group->group_name_utf8);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
230 }
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
231 else {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
232 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(gaim_conv), NULL, group->notice_utf8);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
233 }
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
234 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
235
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
236 void qq_process_group_cmd_get_online_member(guint8 *data, guint8 **cursor, gint len, GaimConnection *gc)
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
237 {
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
238 guint32 internal_group_id, member_uid;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
239 guint8 unknown;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
240 gint bytes, i;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
241 qq_group *group;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
242 qq_buddy *member;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
243
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
244 g_return_if_fail(gc != NULL && data != NULL && len > 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
245
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
246 if (data + len - *cursor < 4) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
247 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Invalid group online member reply, discard it!\n");
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
248 return;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
249 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
250
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
251 bytes = 0;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
252 i = 0;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
253 bytes += read_packet_dw(data, cursor, len, &internal_group_id);
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
254 bytes += read_packet_b(data, cursor, len, &unknown); /* 0x3c ?? */
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
255 g_return_if_fail(internal_group_id > 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
256
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
257 group = qq_group_find_by_internal_group_id(gc, internal_group_id);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
258 if (group == NULL) {
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
259 gaim_debug(GAIM_DEBUG_ERROR, "QQ",
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
260 "We have no group info for internal id [%d]\n", internal_group_id);
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
261 return;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
262 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
263
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
264 /* set all offline first, then update those online */
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
265 _qq_group_set_members_all_offline(group);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
266 while (*cursor < data + len) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
267 bytes += read_packet_dw(data, cursor, len, &member_uid);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
268 i++;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
269 member = qq_group_find_or_add_member(gc, group, member_uid);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
270 if (member != NULL)
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
271 member->status = QQ_BUDDY_ONLINE_NORMAL;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
272 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
273 if(*cursor > (data + len)) {
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
274 gaim_debug(GAIM_DEBUG_ERROR, "QQ",
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
275 "group_cmd_get_online_member: Dangerous error! maybe protocol changed, notify developers!");
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
276 }
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
277
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
278 gaim_debug(GAIM_DEBUG_INFO, "QQ", "Group \"%s\" has %d online members\n", group->group_name_utf8, i);
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
279 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
280
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
281 /* process the reply to get_member_info packet */
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
282 void qq_process_group_cmd_get_member_info(guint8 *data, guint8 **cursor, gint len, GaimConnection *gc)
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
283 {
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
284 guint32 internal_group_id, member_uid;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
285 guint16 unknown;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
286 guint8 bar;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
287 gint pascal_len, i;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
288 qq_group *group;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
289 qq_buddy *member;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
290
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
291 g_return_if_fail(gc != NULL && data != NULL && len > 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
292
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
293 read_packet_dw(data, cursor, len, &internal_group_id);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
294 g_return_if_fail(internal_group_id > 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
295
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
296 group = qq_group_find_by_internal_group_id(gc, internal_group_id);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
297 g_return_if_fail(group != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
298
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
299 i = 0;
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
300 /* now starts the member info, as get buddy list reply */
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
301 while (*cursor < data + len) {
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
302 read_packet_dw(data, cursor, len, &member_uid);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
303 g_return_if_fail(member_uid > 0);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
304 member = qq_group_find_member_by_uid(group, member_uid);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
305 g_return_if_fail(member != NULL);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
306
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
307 i++;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
308 read_packet_b(data, cursor, len, &bar);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
309 read_packet_b(data, cursor, len, &(member->icon));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
310 read_packet_b(data, cursor, len, &(member->age));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
311 read_packet_b(data, cursor, len, &(member->gender));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
312 pascal_len = convert_as_pascal_string(*cursor, &(member->nickname), QQ_CHARSET_DEFAULT);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
313 *cursor += pascal_len;
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
314 read_packet_w(data, cursor, len, &unknown);
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
315 read_packet_b(data, cursor, len, &(member->flag1));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
316 read_packet_b(data, cursor, len, &(member->comm_flag));
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
317
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
318 member->last_refresh = time(NULL);
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
319 }
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
320 if(*cursor > (data + len)) {
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
321 gaim_debug(GAIM_DEBUG_ERROR, "QQ",
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
322 "group_cmd_get_member_info: Dangerous error! maybe protocol changed, notify developers!");
13870
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
323 }
983fd420e86b [gaim-migrate @ 16340]
Mark Huetsch <markhuetsch>
parents:
diff changeset
324 gaim_debug(GAIM_DEBUG_INFO, "QQ", "Group \"%s\" obtained %d member info\n", group->group_name_utf8, i);
14021
ef8490f9e823 [gaim-migrate @ 16618]
Mark Huetsch <markhuetsch>
parents: 13870
diff changeset
325 }