| 85 g_return_if_fail(group != NULL); |
85 g_return_if_fail(group != NULL); |
| 86 |
86 |
| 87 /* only get online members when conversation window is on */ |
87 /* only get online members when conversation window is on */ |
| 88 if (NULL == purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT,group->group_name_utf8, purple_connection_get_account(gc))) { |
88 if (NULL == purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT,group->group_name_utf8, purple_connection_get_account(gc))) { |
| 89 purple_debug(PURPLE_DEBUG_WARNING, "QQ", |
89 purple_debug(PURPLE_DEBUG_WARNING, "QQ", |
| 90 "Conv windows for \"%s\" is not on, do not get online members\n", group->group_name_utf8); |
90 "Conversation for \"%s\" is not open, ignore to get online members\n", group->group_name_utf8); |
| 91 return; |
91 return; |
| 92 } |
92 } |
| 93 |
93 |
| 94 bytes += qq_put8(raw_data + bytes, QQ_GROUP_CMD_GET_ONLINE_MEMBER); |
94 bytes += qq_put8(raw_data + bytes, QQ_GROUP_CMD_GET_ONLINE_MEMBER); |
| 95 bytes += qq_put32(raw_data + bytes, group->internal_group_id); |
95 bytes += qq_put32(raw_data + bytes, group->internal_group_id); |
| 184 bytes += qq_get32(&unknown4, data + bytes); /* oldCategory */ |
182 bytes += qq_get32(&unknown4, data + bytes); /* oldCategory */ |
| 185 bytes += qq_get16(&unknown, data + bytes); |
183 bytes += qq_get16(&unknown, data + bytes); |
| 186 bytes += qq_get32(&(group->group_category), data + bytes); |
184 bytes += qq_get32(&(group->group_category), data + bytes); |
| 187 bytes += qq_get16(&max_members, data + bytes); |
185 bytes += qq_get16(&max_members, data + bytes); |
| 188 bytes += qq_get8(&unknown1, data + bytes); |
186 bytes += qq_get8(&unknown1, data + bytes); |
| 189 /* XXX |
187 /* the following, while Eva: |
| 190 * the following, while Eva: |
|
| 191 * 4(unk), 4(verID), 1(nameLen), nameLen(qunNameContent), 1(0x00), |
188 * 4(unk), 4(verID), 1(nameLen), nameLen(qunNameContent), 1(0x00), |
| 192 * 2(qunNoticeLen), qunNoticeLen(qunNoticeContent, 1(qunDescLen), |
189 * 2(qunNoticeLen), qunNoticeLen(qunNoticeContent, 1(qunDescLen), |
| 193 * qunDestLen(qunDestcontent)) */ |
190 * qunDestLen(qunDestcontent)) */ |
| 194 bytes += qq_get8(&unknown1, data + bytes); |
191 bytes += qq_get8(&unknown1, data + bytes); |
| 195 purple_debug(PURPLE_DEBUG_INFO, "QQ", "type=%u creatorid=%u category=%u\n", |
192 purple_debug(PURPLE_DEBUG_INFO, "QQ", "type=%u creatorid=%u category=%u maxmembers=%u\n", |
| 196 group->group_type, group->creator_uid, group->group_category); |
193 group->group_type, group->creator_uid, group->group_category, max_members); |
| 197 purple_debug(PURPLE_DEBUG_INFO, "QQ", "maxmembers=%u", max_members); |
|
| 198 |
194 |
| 199 /* strlen + <str content> */ |
195 /* strlen + <str content> */ |
| 200 bytes += convert_as_pascal_string(data + bytes, &(group->group_name_utf8), QQ_CHARSET_DEFAULT); |
196 bytes += convert_as_pascal_string(data + bytes, &(group->group_name_utf8), QQ_CHARSET_DEFAULT); |
| 201 purple_debug(PURPLE_DEBUG_INFO, "QQ", "group \"%s\"\n", group->group_name_utf8); |
197 purple_debug(PURPLE_DEBUG_INFO, "QQ", "group \"%s\"\n", group->group_name_utf8); |
| 202 bytes += qq_get16(&unknown, data + bytes); /* 0x0000 */ |
198 bytes += qq_get16(&unknown, data + bytes); /* 0x0000 */ |
| 203 bytes += convert_as_pascal_string(data + bytes, &(group->notice_utf8), QQ_CHARSET_DEFAULT); |
199 bytes += convert_as_pascal_string(data + bytes, ¬ice, QQ_CHARSET_DEFAULT); |
| 204 purple_debug(PURPLE_DEBUG_INFO, "QQ", "notice \"%s\"\n", group->notice_utf8); |
200 purple_debug(PURPLE_DEBUG_INFO, "QQ", "notice \"%s\"\n", notice); |
| 205 bytes += convert_as_pascal_string(data + bytes, &(group->group_desc_utf8), QQ_CHARSET_DEFAULT); |
201 bytes += convert_as_pascal_string(data + bytes, &(group->group_desc_utf8), QQ_CHARSET_DEFAULT); |
| 206 purple_debug(PURPLE_DEBUG_INFO, "QQ", "group_desc \"%s\"\n", group->group_desc_utf8); |
202 purple_debug(PURPLE_DEBUG_INFO, "QQ", "group_desc \"%s\"\n", group->group_desc_utf8); |
| 207 |
203 |
| 208 num = 0; |
204 num = 0; |
| 209 /* now comes the member list separated by 0x00 */ |
205 /* now comes the member list separated by 0x00 */ |
| 233 |
229 |
| 234 purple_conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
230 purple_conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
| 235 group->group_name_utf8, purple_connection_get_account(gc)); |
231 group->group_name_utf8, purple_connection_get_account(gc)); |
| 236 if(NULL == purple_conv) { |
232 if(NULL == purple_conv) { |
| 237 purple_debug(PURPLE_DEBUG_WARNING, "QQ", |
233 purple_debug(PURPLE_DEBUG_WARNING, "QQ", |
| 238 "Conv windows for \"%s\" is not on, do not set topic\n", group->group_name_utf8); |
234 "Conversation for \"%s\" is not open, do not set topic\n", group->group_name_utf8); |
| 239 } |
235 return; |
| 240 else { |
236 } |
| 241 purple_conv_chat_set_topic(PURPLE_CONV_CHAT(purple_conv), NULL, group->notice_utf8); |
237 |
| 242 } |
238 /* filter \r\n in notice */ |
| |
239 qq_filter_str(notice); |
| |
240 group->notice_utf8 = strdup(notice); |
| |
241 g_free(notice); |
| |
242 |
| |
243 purple_conv_chat_set_topic(PURPLE_CONV_CHAT(purple_conv), NULL, group->notice_utf8); |
| 243 } |
244 } |
| 244 |
245 |
| 245 void qq_process_group_cmd_get_online_members(guint8 *data, gint len, PurpleConnection *gc) |
246 void qq_process_group_cmd_get_online_members(guint8 *data, gint len, PurpleConnection *gc) |
| 246 { |
247 { |
| 247 guint32 internal_group_id, member_uid; |
248 guint32 internal_group_id, member_uid; |
| 316 |
318 |
| 317 num++; |
319 num++; |
| 318 bytes += qq_get16(&(member->face), data + bytes); |
320 bytes += qq_get16(&(member->face), data + bytes); |
| 319 bytes += qq_get8(&(member->age), data + bytes); |
321 bytes += qq_get8(&(member->age), data + bytes); |
| 320 bytes += qq_get8(&(member->gender), data + bytes); |
322 bytes += qq_get8(&(member->gender), data + bytes); |
| 321 bytes += convert_as_pascal_string(data + bytes, &(member->nickname), QQ_CHARSET_DEFAULT); |
323 bytes += convert_as_pascal_string(data + bytes, &nick, QQ_CHARSET_DEFAULT); |
| 322 bytes += qq_get16(&unknown, data + bytes); |
324 bytes += qq_get16(&unknown, data + bytes); |
| 323 bytes += qq_get8(&(member->flag1), data + bytes); |
325 bytes += qq_get8(&(member->flag1), data + bytes); |
| 324 bytes += qq_get8(&(member->comm_flag), data + bytes); |
326 bytes += qq_get8(&(member->comm_flag), data + bytes); |
| 325 |
327 |
| |
328 /* filter \r\n in nick */ |
| |
329 qq_filter_str(nick); |
| |
330 member->nickname = g_strdup(nick); |
| |
331 g_free(nick); |
| |
332 |
| |
333 /* |
| |
334 if (QQ_DEBUG) { |
| |
335 purple_debug(PURPLE_DEBUG_INFO, "QQ", |
| |
336 "member [%09d]: flag1=0x%02x, comm_flag=0x%02x, nick=%s\n", |
| |
337 member_uid, member->flag1, member->comm_flag, member->nickname); |
| |
338 } |
| |
339 */ |
| |
340 |
| 326 member->last_refresh = time(NULL); |
341 member->last_refresh = time(NULL); |
| 327 } |
342 } |
| 328 if(bytes > len) { |
343 if(bytes > len) { |
| 329 purple_debug(PURPLE_DEBUG_ERROR, "QQ", |
344 purple_debug(PURPLE_DEBUG_ERROR, "QQ", |
| 330 "group_cmd_get_members_info: Dangerous error! maybe protocol changed, notify developers!"); |
345 "group_cmd_get_members_info: Dangerous error! maybe protocol changed, notify developers!"); |