comparison libpurple/protocols/qq/im.c @ 23878:967344bc404d

applied changes from f12c8903079425d7850fa183df0b3f937b2952be through 8cebefbc6cd5d84acb69c74e69e8821f11dd225d Backport of 8cebefbc6cd5d84acb69c74e69e8821f11dd225d to avoid having other changes overwritten. 2008.08.16 - ccpaging <ecc_hy(at)hotmail.com> * Rename group to room. If you used pidginqq before, this may create a new room with same title, you may delete old one * Replace purple_debug with purple_debug_info, purple_debug_warning, purple_debug_error * Add server notice and server new, and two options to turn on/off * Minor modify for reducing transaction's debug infor * Minor modifies for system notice and QQ news. * Add 4 new strings need translate compare with p10. committer: Daniel Atallah <daniel.atallah@gmail.com>
author SHiNE CsyFeK <csyfek@gmail.com>
date Mon, 15 Sep 2008 02:59:23 +0000
parents 5f454b975a99
children 23cec4360d4a 25f62d21b3f8
comparison
equal deleted inserted replaced
23695:5f454b975a99 23878:967344bc404d
207 return "QQ_RECV_IM_REJCT_APPLY_ADD_TO_QUN"; 207 return "QQ_RECV_IM_REJCT_APPLY_ADD_TO_QUN";
208 case QQ_RECV_IM_TEMP_QUN_IM: 208 case QQ_RECV_IM_TEMP_QUN_IM:
209 return "QQ_RECV_IM_TEMP_QUN_IM"; 209 return "QQ_RECV_IM_TEMP_QUN_IM";
210 case QQ_RECV_IM_QUN_IM: 210 case QQ_RECV_IM_QUN_IM:
211 return "QQ_RECV_IM_QUN_IM"; 211 return "QQ_RECV_IM_QUN_IM";
212 case QQ_RECV_IM_NEWS:
213 return "QQ_RECV_IM_NEWS";
214 case QQ_RECV_IM_FROM_BUDDY_2006:
215 return "QQ_RECV_IM_FROM_BUDDY_2006";
216 case QQ_RECV_IM_FROM_UNKNOWN_2006:
217 return "QQ_RECV_IM_FROM_UNKNOWN_2006";
212 default: 218 default:
213 return "QQ_RECV_IM_UNKNOWN"; 219 return "QQ_RECV_IM_UNKNOWN";
214 } 220 }
215 }
216
217 /* when we receive a message,
218 * we send an ACK which is the first 16 bytes of incoming packet */
219 static void _qq_send_packet_recv_im_ack(PurpleConnection *gc, guint16 seq, guint8 *data)
220 {
221 qq_data *qd;
222
223 qd = (qq_data *) gc->proto_data;
224 qq_send_cmd_detail(qd, QQ_CMD_RECV_IM, seq, FALSE, data, 16);
225 } 221 }
226 222
227 /* read the common parts of the normal_im, 223 /* read the common parts of the normal_im,
228 * returns the bytes read if succeed, or -1 if there is any error */ 224 * returns the bytes read if succeed, or -1 if there is any error */
229 static gint _qq_normal_im_common_read(guint8 *data, gint len, qq_recv_normal_im_common *common) 225 static gint _qq_normal_im_common_read(guint8 *data, gint len, qq_recv_normal_im_common *common)
238 bytes += qq_get32(&(common->receiver_uid), data + bytes); 234 bytes += qq_get32(&(common->receiver_uid), data + bytes);
239 bytes += qq_getdata(common->session_md5, QQ_KEY_LENGTH, data + bytes); 235 bytes += qq_getdata(common->session_md5, QQ_KEY_LENGTH, data + bytes);
240 bytes += qq_get16(&(common->normal_im_type), data + bytes); 236 bytes += qq_get16(&(common->normal_im_type), data + bytes);
241 237
242 if (bytes != 28) { /* read common place fail */ 238 if (bytes != 28) { /* read common place fail */
243 purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Expect 28 bytes, read %d bytes\n", bytes); 239 purple_debug_error("QQ", "Expect 28 bytes, read %d bytes\n", bytes);
244 return -1; 240 return -1;
245 } 241 }
246 242
247 return bytes; 243 return bytes;
244 }
245
246 static void _qq_process_recv_news(guint8 *data, gint data_len, PurpleConnection *gc)
247 {
248 qq_data *qd = (qq_data *) gc->proto_data;
249 gint bytes;
250 guint8 *temp;
251 guint8 temp_len;
252 gchar *title, *brief, *url;
253 gchar *content, *content_utf8;
254
255 g_return_if_fail(data != NULL && data_len != 0);
256
257 #if 0
258 qq_show_packet("Rcv news", data, data_len);
259 #endif
260
261 temp = g_newa(guint8, data_len);
262 bytes = 4; // ignore unknown 4 bytes
263
264 bytes += qq_get8(&temp_len, data + bytes);
265 g_return_if_fail(bytes + temp_len <= data_len);
266 bytes += qq_getdata(temp, temp_len, data+bytes);
267 title = g_strndup((gchar *)temp, temp_len);
268
269 bytes += qq_get8(&temp_len, data + bytes);
270 g_return_if_fail(bytes + temp_len <= data_len);
271 bytes += qq_getdata(temp, temp_len, data+bytes);
272 brief = g_strndup((gchar *)temp, temp_len);
273
274 bytes += qq_get8(&temp_len, data + bytes);
275 g_return_if_fail(bytes + temp_len <= data_len);
276 bytes += qq_getdata(temp, temp_len, data+bytes);
277 url = g_strndup((gchar *)temp, temp_len);
278
279 content = g_strdup_printf(_("Title: %s\nBrief: %s\n\n%s"), title, brief, url);
280 content_utf8 = qq_to_utf8(content, QQ_CHARSET_DEFAULT);
281
282 if (qd->is_show_news) {
283 purple_notify_info(gc, NULL, _("QQ Server News"), content_utf8);
284 } else {
285 purple_debug_info("QQ", "QQ Server news:\n%s", content_utf8);
286 }
287 g_free(title);
288 g_free(brief);
289 g_free(url);
290 g_free(content);
291 g_free(content_utf8);
248 } 292 }
249 293
250 /* process received normal text IM */ 294 /* process received normal text IM */
251 static void _qq_process_recv_normal_im_text(guint8 *data, gint len, qq_recv_normal_im_common *common, PurpleConnection *gc) 295 static void _qq_process_recv_normal_im_text(guint8 *data, gint len, qq_recv_normal_im_common *common, PurpleConnection *gc)
252 { 296 {
264 qd = (qq_data *) gc->proto_data; 308 qd = (qq_data *) gc->proto_data;
265 309
266 /* now it is QQ_NORMAL_IM_TEXT */ 310 /* now it is QQ_NORMAL_IM_TEXT */
267 /* 311 /*
268 if (*cursor >= (data + len - 1)) { 312 if (*cursor >= (data + len - 1)) {
269 purple_debug(PURPLE_DEBUG_WARNING, "QQ", "Received normal IM text is empty\n"); 313 purple_debug_warning("QQ", "Received normal IM text is empty\n");
270 return; 314 return;
271 } else 315 } else
272 */ 316 */
273 im_text = g_newa(qq_recv_normal_im_text, 1); 317 im_text = g_newa(qq_recv_normal_im_text, 1);
274 318
311 qq_add_buddy_by_recv_packet(gc, common->sender_uid, FALSE, TRUE); 355 qq_add_buddy_by_recv_packet(gc, common->sender_uid, FALSE, TRUE);
312 b = purple_find_buddy(gc->account, name); 356 b = purple_find_buddy(gc->account, name);
313 } 357 }
314 qq_b = (b == NULL) ? NULL : (qq_buddy *) b->proto_data; 358 qq_b = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
315 if (qq_b != NULL) { 359 if (qq_b != NULL) {
316 qq_b->client_version = common->sender_ver; 360 qq_b->client_version = common->sender_ver;
317 } 361 }
318 362
319 purple_msg_type = (im_text->msg_type == QQ_IM_AUTO_REPLY) ? PURPLE_MESSAGE_AUTO_RESP : 0; 363 purple_msg_type = (im_text->msg_type == QQ_IM_AUTO_REPLY) ? PURPLE_MESSAGE_AUTO_RESP : 0;
320 364
321 msg_with_purple_smiley = qq_smiley_to_purple(im_text->msg); 365 msg_with_purple_smiley = qq_smiley_to_purple(im_text->msg);
322 msg_utf8_encoded = im_text->is_there_font_attr ? 366 msg_utf8_encoded = im_text->is_there_font_attr ?
323 qq_encode_to_purple(im_text->font_attr, 367 qq_encode_to_purple(im_text->font_attr,
348 392
349 common = g_newa (qq_recv_normal_im_common, 1); 393 common = g_newa (qq_recv_normal_im_common, 1);
350 394
351 bytes = _qq_normal_im_common_read(data, len, common); 395 bytes = _qq_normal_im_common_read(data, len, common);
352 if (bytes < 0) { 396 if (bytes < 0) {
353 purple_debug (PURPLE_DEBUG_ERROR, "QQ", 397 purple_debug_error("QQ", "Fail read the common part of normal IM\n");
354 "Fail read the common part of normal IM\n");
355 return; 398 return;
356 } 399 }
357 400
358 switch (common->normal_im_type) { 401 switch (common->normal_im_type) {
359 case QQ_NORMAL_IM_TEXT: 402 case QQ_NORMAL_IM_TEXT:
360 purple_debug (PURPLE_DEBUG_INFO, "QQ", 403 purple_debug_info("QQ",
361 "Normal IM, text type:\n [%d] => [%d], src: %s (%04X)\n", 404 "Normal IM, text type:\n [%d] => [%d], src: %s (%04X)\n",
362 common->sender_uid, common->receiver_uid, 405 common->sender_uid, common->receiver_uid,
363 qq_get_ver_desc (common->sender_ver), common->sender_ver); 406 qq_get_ver_desc (common->sender_ver), common->sender_ver);
364 if (bytes >= len - 1) { 407 if (bytes >= len - 1) {
365 purple_debug(PURPLE_DEBUG_WARNING, "QQ", "Received normal IM text is empty\n"); 408 purple_debug_warning("QQ", "Received normal IM text is empty\n");
366 return; 409 return;
367 } 410 }
368 _qq_process_recv_normal_im_text(data + bytes, len - bytes, common, gc); 411 _qq_process_recv_normal_im_text(data + bytes, len - bytes, common, gc);
369 break; 412 break;
370 case QQ_NORMAL_IM_FILE_REJECT_UDP: 413 case QQ_NORMAL_IM_FILE_REJECT_UDP:
379 case QQ_NORMAL_IM_FILE_CANCEL: 422 case QQ_NORMAL_IM_FILE_CANCEL:
380 qq_process_recv_file_cancel(data + bytes, len - bytes, common->sender_uid, gc); 423 qq_process_recv_file_cancel(data + bytes, len - bytes, common->sender_uid, gc);
381 break; 424 break;
382 case QQ_NORMAL_IM_FILE_NOTIFY: 425 case QQ_NORMAL_IM_FILE_NOTIFY:
383 qq_process_recv_file_notify(data + bytes, len - bytes, common->sender_uid, gc); 426 qq_process_recv_file_notify(data + bytes, len - bytes, common->sender_uid, gc);
427 break;
428 case QQ_NORMAL_IM_FILE_REQUEST_TCP:
429 /* Check ReceivedFileIM::parseContents in eva*/
430 /* some client use this function for detect invisable buddy*/
431 purple_debug_warning("QQ", "Normal IM, not support QQ_NORMAL_IM_FILE_REQUEST_TCP\n");
432 qq_show_packet ("Not support", data, len);
433 break;
434 case QQ_NORMAL_IM_FILE_APPROVE_TCP:
435 purple_debug_warning("QQ", "Normal IM, not support QQ_NORMAL_IM_FILE_APPROVE_TCP\n");
436 qq_show_packet ("Not support", data, len);
437 break;
438 case QQ_NORMAL_IM_FILE_REJECT_TCP:
439 purple_debug_warning("QQ", "Normal IM, not support QQ_NORMAL_IM_FILE_REJECT_TCP\n");
440 qq_show_packet ("Not support", data, len);
441 break;
442 case QQ_NORMAL_IM_FILE_PASV:
443 purple_debug_warning("QQ", "Normal IM, not support QQ_NORMAL_IM_FILE_PASV\n");
444 qq_show_packet ("Not support", data, len);
445 break;
446 case QQ_NORMAL_IM_FILE_EX_REQUEST_UDP:
447 purple_debug_warning("QQ", "Normal IM, not support QQ_NORMAL_IM_FILE_REQUEST_TCP\n");
448 qq_show_packet ("QQ", data, len);
449 break;
450 case QQ_NORMAL_IM_FILE_EX_REQUEST_ACCEPT:
451 purple_debug_warning("QQ", "Normal IM, not support QQ_NORMAL_IM_FILE_EX_REQUEST_ACCEPT\n");
452 qq_show_packet ("QQ", data, len);
453 break;
454 case QQ_NORMAL_IM_FILE_EX_REQUEST_CANCEL:
455 purple_debug_warning("QQ", "Normal IM, not support QQ_NORMAL_IM_FILE_EX_REQUEST_CANCEL\n");
456 qq_show_packet ("Not support", data, len);
457 break;
458 case QQ_NORMAL_IM_FILE_EX_NOTIFY_IP:
459 purple_debug_warning("QQ", "Normal IM, not support QQ_NORMAL_IM_FILE_EX_NOTIFY_IP\n");
460 qq_show_packet ("Not support", data, len);
384 break; 461 break;
385 default: 462 default:
386 im_unprocessed = g_newa (qq_recv_normal_im_unprocessed, 1); 463 im_unprocessed = g_newa (qq_recv_normal_im_unprocessed, 1);
387 im_unprocessed->common = common; 464 im_unprocessed->common = common;
388 im_unprocessed->unknown = data + bytes; 465 im_unprocessed->unknown = data + bytes;
389 im_unprocessed->length = len - bytes; 466 im_unprocessed->length = len - bytes;
390 /* a simple process here, maybe more later */ 467 /* a simple process here, maybe more later */
391 purple_debug (PURPLE_DEBUG_WARNING, "QQ", 468 purple_debug_warning("QQ",
392 "Normal IM, unprocessed type [0x%04x], len %d\n", 469 "Normal IM, unprocessed type [0x%04x], len %d\n",
393 common->normal_im_type, im_unprocessed->length); 470 common->normal_im_type, im_unprocessed->length);
394 qq_show_packet ("QQ unk-im", im_unprocessed->unknown, im_unprocessed->length); 471 qq_show_packet ("QQ", im_unprocessed->unknown, im_unprocessed->length);
395 return; 472 return;
396 } 473 }
397 } 474 }
398 475
399 /* process im from system administrator */ 476 /* process im from system administrator */
410 if (NULL == (segments = split_data(data, len, "\x2f", 2))) 487 if (NULL == (segments = split_data(data, len, "\x2f", 2)))
411 return; 488 return;
412 489
413 reply = strtol(segments[0], NULL, 10); 490 reply = strtol(segments[0], NULL, 10);
414 if (reply == QQ_RECV_SYS_IM_KICK_OUT) 491 if (reply == QQ_RECV_SYS_IM_KICK_OUT)
415 purple_debug(PURPLE_DEBUG_WARNING, "QQ", "We are kicked out by QQ server\n"); 492 purple_debug_warning("QQ", "We are kicked out by QQ server\n");
416 msg_utf8 = qq_to_utf8(segments[1], QQ_CHARSET_DEFAULT); 493 msg_utf8 = qq_to_utf8(segments[1], QQ_CHARSET_DEFAULT);
417 purple_notify_warning(gc, NULL, _("System Message"), msg_utf8); 494 purple_notify_warning(gc, NULL, _("System Message"), msg_utf8);
418 } 495 }
419 496
420 /* send an IM to to_uid */ 497 /* send an IM to to_uid */
473 if (purple_markup_find_tag("u", msg, &start, &end, &attribs)) { 550 if (purple_markup_find_tag("u", msg, &start, &end, &attribs)) {
474 is_underline = TRUE; 551 is_underline = TRUE;
475 g_datalist_clear(&attribs); 552 g_datalist_clear(&attribs);
476 } 553 }
477 554
478 purple_debug(PURPLE_DEBUG_INFO, "QQ_MESG", "send mesg: %s\n", msg); 555 purple_debug_info("QQ_MESG", "send mesg: %s\n", msg);
479 msg_filtered = purple_markup_strip_html(msg); 556 msg_filtered = purple_markup_strip_html(msg);
480 msg_len = strlen(msg_filtered); 557 msg_len = strlen(msg_filtered);
481 now = time(NULL); 558 now = time(NULL);
482 559
483 font_name_len = (font_name) ? strlen(font_name) : DEFAULT_FONT_NAME_LEN; 560 font_name_len = (font_name) ? strlen(font_name) : DEFAULT_FONT_NAME_LEN;
524 bytes += qq_putdata(raw_data + bytes, send_im_tail, tail_len); 601 bytes += qq_putdata(raw_data + bytes, send_im_tail, tail_len);
525 602
526 qq_show_packet("QQ_raw_data debug", raw_data, bytes); 603 qq_show_packet("QQ_raw_data debug", raw_data, bytes);
527 604
528 if (bytes == raw_len) /* create packet OK */ 605 if (bytes == raw_len) /* create packet OK */
529 qq_send_cmd(qd, QQ_CMD_SEND_IM, raw_data, bytes); 606 qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes);
530 else 607 else
531 purple_debug(PURPLE_DEBUG_ERROR, "QQ", 608 purple_debug_error("QQ",
532 "Fail creating send_im packet, expect %d bytes, build %d bytes\n", raw_len, bytes); 609 "Fail creating send_im packet, expect %d bytes, build %d bytes\n", raw_len, bytes);
533 610
534 if (font_color) 611 if (font_color)
535 g_free(font_color); 612 g_free(font_color);
536 if (font_size) 613 if (font_size)
547 g_return_if_fail(data != NULL && data_len != 0); 624 g_return_if_fail(data != NULL && data_len != 0);
548 625
549 qd = gc->proto_data; 626 qd = gc->proto_data;
550 627
551 if (data[0] != QQ_SEND_IM_REPLY_OK) { 628 if (data[0] != QQ_SEND_IM_REPLY_OK) {
552 purple_debug(PURPLE_DEBUG_WARNING, "QQ", "Send IM fail\n"); 629 purple_debug_warning("QQ", "Send IM fail\n");
553 purple_notify_error(gc, _("Error"), _("Failed to send IM."), NULL); 630 purple_notify_error(gc, _("Error"), _("Failed to send IM."), NULL);
554 } else { 631 } else {
555 purple_debug(PURPLE_DEBUG_INFO, "QQ", "IM ACK OK\n"); 632 purple_debug_info("QQ", "IM ACK OK\n");
556 } 633 }
557 } 634 }
558 635
559 /* I receive a message, mainly it is text msg, 636 /* I receive a message, mainly it is text msg,
560 * but we need to proess other types (group etc) */ 637 * but we need to proess other types (group etc) */
567 g_return_if_fail(data != NULL && data_len != 0); 644 g_return_if_fail(data != NULL && data_len != 0);
568 645
569 qd = (qq_data *) gc->proto_data; 646 qd = (qq_data *) gc->proto_data;
570 647
571 if (data_len < 16) { /* we need to ack with the first 16 bytes */ 648 if (data_len < 16) { /* we need to ack with the first 16 bytes */
572 purple_debug(PURPLE_DEBUG_ERROR, "QQ", "IM is too short\n"); 649 purple_debug_error("QQ", "MSG is too short\n");
573 return; 650 return;
574 } else { 651 } else {
575 _qq_send_packet_recv_im_ack(gc, seq, data); 652 /* when we receive a message,
653 * we send an ACK which is the first 16 bytes of incoming packet */
654 qq_send_server_reply(gc, QQ_CMD_RECV_IM, seq, data, 16);
576 } 655 }
577 656
578 /* check len first */ 657 /* check len first */
579 if (data_len < 20) { /* length of im_header */ 658 if (data_len < 20) { /* length of im_header */
580 purple_debug(PURPLE_DEBUG_ERROR, "QQ", 659 purple_debug_error("QQ", "Invald MSG header, len %d < 20\n", data_len);
581 "Fail read recv IM header, len should longer than 20 bytes, read %d bytes\n", data_len);
582 return; 660 return;
583 } 661 }
584 662
585 bytes = 0; 663 bytes = 0;
586 im_header = g_newa(qq_recv_im_header, 1); 664 im_header = g_newa(qq_recv_im_header, 1);
592 bytes += qq_get16(&(im_header->sender_port), data + bytes); 670 bytes += qq_get16(&(im_header->sender_port), data + bytes);
593 bytes += qq_get16(&(im_header->im_type), data + bytes); 671 bytes += qq_get16(&(im_header->im_type), data + bytes);
594 /* im_header prepared */ 672 /* im_header prepared */
595 673
596 if (im_header->receiver_uid != qd->uid) { /* should not happen */ 674 if (im_header->receiver_uid != qd->uid) { /* should not happen */
597 purple_debug(PURPLE_DEBUG_ERROR, "QQ", "IM to [%d], NOT me\n", im_header->receiver_uid); 675 purple_debug_error("QQ", "MSG to [%d], NOT me\n", im_header->receiver_uid);
598 return; 676 return;
599 } 677 }
600 678
601 /* check bytes */ 679 /* check bytes */
602 if (bytes >= data_len - 1) { 680 if (bytes >= data_len - 1) {
603 purple_debug (PURPLE_DEBUG_WARNING, "QQ", "Received IM is empty\n"); 681 purple_debug_warning("QQ", "Empty MSG\n");
604 return; 682 return;
605 } 683 }
606 684
607 switch (im_header->im_type) { 685 switch (im_header->im_type) {
686 case QQ_RECV_IM_NEWS:
687 _qq_process_recv_news(data + bytes, data_len - bytes, gc);
688 break;
689 case QQ_RECV_IM_FROM_BUDDY_2006:
690 case QQ_RECV_IM_FROM_UNKNOWN_2006:
691 case QQ_RECV_IM_TO_UNKNOWN:
608 case QQ_RECV_IM_TO_BUDDY: 692 case QQ_RECV_IM_TO_BUDDY:
609 purple_debug(PURPLE_DEBUG_INFO, "QQ", 693 purple_debug_info("QQ", "MSG from buddy [%d]\n", im_header->sender_uid);
610 "IM from buddy [%d], I am in his/her buddy list\n", im_header->sender_uid);
611 _qq_process_recv_normal_im(data + bytes, data_len - bytes, gc); /* position and rest length */
612 break;
613 case QQ_RECV_IM_TO_UNKNOWN:
614 purple_debug(PURPLE_DEBUG_INFO, "QQ",
615 "IM from buddy [%d], I am a stranger to him/her\n", im_header->sender_uid);
616 _qq_process_recv_normal_im(data + bytes, data_len - bytes, gc); 694 _qq_process_recv_normal_im(data + bytes, data_len - bytes, gc);
617 break; 695 break;
618 case QQ_RECV_IM_UNKNOWN_QUN_IM: 696 case QQ_RECV_IM_UNKNOWN_QUN_IM:
619 case QQ_RECV_IM_TEMP_QUN_IM: 697 case QQ_RECV_IM_TEMP_QUN_IM:
620 case QQ_RECV_IM_QUN_IM: 698 case QQ_RECV_IM_QUN_IM:
621 purple_debug(PURPLE_DEBUG_INFO, "QQ", "IM from group, internal_id [%d]\n", im_header->sender_uid); 699 purple_debug_info("QQ", "MSG from room [%d]\n", im_header->sender_uid);
622 /* sender_uid is in fact id */ 700 /* sender_uid is in fact id */
623 qq_process_recv_group_im(data + bytes, data_len - bytes, im_header->sender_uid, gc, im_header->im_type); 701 qq_process_room_msg_normal(data + bytes, data_len - bytes, im_header->sender_uid, gc, im_header->im_type);
624 break; 702 break;
625 case QQ_RECV_IM_ADD_TO_QUN: 703 case QQ_RECV_IM_ADD_TO_QUN:
626 purple_debug(PURPLE_DEBUG_INFO, "QQ", 704 purple_debug_info("QQ", "Notice from [%d], Added\n", im_header->sender_uid);
627 "IM from group, added by group internal_id [%d]\n", im_header->sender_uid);
628 /* sender_uid is group id 705 /* sender_uid is group id
629 * we need this to create a dummy group and add to blist */ 706 * we need this to create a dummy group and add to blist */
630 qq_process_recv_group_im_been_added(data + bytes, data_len - bytes, im_header->sender_uid, gc); 707 qq_process_room_msg_been_added(data + bytes, data_len - bytes, im_header->sender_uid, gc);
631 break; 708 break;
632 case QQ_RECV_IM_DEL_FROM_QUN: 709 case QQ_RECV_IM_DEL_FROM_QUN:
633 purple_debug(PURPLE_DEBUG_INFO, "QQ", 710 purple_debug_info("QQ", "Notice from room [%d], Removed\n", im_header->sender_uid);
634 "IM from group, removed by group internal_ID [%d]\n", im_header->sender_uid);
635 /* sender_uid is group id */ 711 /* sender_uid is group id */
636 qq_process_recv_group_im_been_removed(data + bytes, data_len - bytes, im_header->sender_uid, gc); 712 qq_process_room_msg_been_removed(data + bytes, data_len - bytes, im_header->sender_uid, gc);
637 break; 713 break;
638 case QQ_RECV_IM_APPLY_ADD_TO_QUN: 714 case QQ_RECV_IM_APPLY_ADD_TO_QUN:
639 purple_debug(PURPLE_DEBUG_INFO, "QQ", 715 purple_debug_info("QQ", "Notice from room [%d], Joined\n", im_header->sender_uid);
640 "IM from group, apply to join group internal_ID [%d]\n", im_header->sender_uid);
641 /* sender_uid is group id */ 716 /* sender_uid is group id */
642 qq_process_recv_group_im_apply_join(data + bytes, data_len - bytes, im_header->sender_uid, gc); 717 qq_process_room_msg_apply_join(data + bytes, data_len - bytes, im_header->sender_uid, gc);
643 break; 718 break;
644 case QQ_RECV_IM_APPROVE_APPLY_ADD_TO_QUN: 719 case QQ_RECV_IM_APPROVE_APPLY_ADD_TO_QUN:
645 purple_debug(PURPLE_DEBUG_INFO, "QQ", 720 purple_debug_info("QQ", "Notice from room [%d], Confirm add in\n",
646 "IM for group system info, approved by group internal_id [%d]\n",
647 im_header->sender_uid); 721 im_header->sender_uid);
648 /* sender_uid is group id */ 722 /* sender_uid is group id */
649 qq_process_recv_group_im_been_approved(data + bytes, data_len - bytes, im_header->sender_uid, gc); 723 qq_process_room_msg_been_approved(data + bytes, data_len - bytes, im_header->sender_uid, gc);
650 break; 724 break;
651 case QQ_RECV_IM_REJCT_APPLY_ADD_TO_QUN: 725 case QQ_RECV_IM_REJCT_APPLY_ADD_TO_QUN:
652 purple_debug(PURPLE_DEBUG_INFO, "QQ", 726 purple_debug_info("QQ", "Notice from room [%d], Refuse add in\n",
653 "IM for group system info, rejected by group internal_id [%d]\n",
654 im_header->sender_uid); 727 im_header->sender_uid);
655 /* sender_uid is group id */ 728 /* sender_uid is group id */
656 qq_process_recv_group_im_been_rejected(data + bytes, data_len - bytes, im_header->sender_uid, gc); 729 qq_process_room_msg_been_rejected(data + bytes, data_len - bytes, im_header->sender_uid, gc);
657 break; 730 break;
658 case QQ_RECV_IM_SYS_NOTIFICATION: 731 case QQ_RECV_IM_SYS_NOTIFICATION:
659 purple_debug(PURPLE_DEBUG_INFO, "QQ", 732 purple_debug_info("QQ", "Admin notice from [%d]\n", im_header->sender_uid);
660 "IM from [%d], should be a system administrator\n", im_header->sender_uid);
661 _qq_process_recv_sys_im(data + bytes, data_len - bytes, gc); 733 _qq_process_recv_sys_im(data + bytes, data_len - bytes, gc);
662 break; 734 break;
663 default: 735 default:
664 purple_debug(PURPLE_DEBUG_WARNING, "QQ", 736 purple_debug_warning("QQ", "MSG from [%d], unknown type %s [0x%02x]\n",
665 "IM from [%d], [0x%02x] %s is not processed\n", 737 im_header->sender_uid, qq_get_recv_im_type_str(im_header->im_type),
666 im_header->sender_uid, 738 im_header->im_type);
667 im_header->im_type, qq_get_recv_im_type_str(im_header->im_type)); 739 qq_show_packet("Unknown MSG type", data, data_len);
668 } 740 }
669 } 741 }
670 742