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