comparison libpurple/protocols/qq/im.c @ 24095:25f62d21b3f8

disapproval of revision '8cebefbc6cd5d84acb69c74e69e8821f11dd225d'
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 15 Sep 2008 03:04:07 +0000
parents 147ada94a1d8
children 225e0e9e1055
comparison
equal deleted inserted replaced
24088:147ada94a1d8 24095:25f62d21b3f8
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";
218 default: 212 default:
219 return "QQ_RECV_IM_UNKNOWN"; 213 return "QQ_RECV_IM_UNKNOWN";
220 } 214 }
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);
221 } 225 }
222 226
223 /* read the common parts of the normal_im, 227 /* read the common parts of the normal_im,
224 * returns the bytes read if succeed, or -1 if there is any error */ 228 * returns the bytes read if succeed, or -1 if there is any error */
225 static gint _qq_normal_im_common_read(guint8 *data, gint len, qq_recv_normal_im_common *common) 229 static gint _qq_normal_im_common_read(guint8 *data, gint len, qq_recv_normal_im_common *common)
234 bytes += qq_get32(&(common->receiver_uid), data + bytes); 238 bytes += qq_get32(&(common->receiver_uid), data + bytes);
235 bytes += qq_getdata(common->session_md5, QQ_KEY_LENGTH, data + bytes); 239 bytes += qq_getdata(common->session_md5, QQ_KEY_LENGTH, data + bytes);
236 bytes += qq_get16(&(common->normal_im_type), data + bytes); 240 bytes += qq_get16(&(common->normal_im_type), data + bytes);
237 241
238 if (bytes != 28) { /* read common place fail */ 242 if (bytes != 28) { /* read common place fail */
239 purple_debug_error("QQ", "Expect 28 bytes, read %d bytes\n", bytes); 243 purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Expect 28 bytes, read %d bytes\n", bytes);
240 return -1; 244 return -1;
241 } 245 }
242 246
243 return bytes; 247 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);
292 } 248 }
293 249
294 /* process received normal text IM */ 250 /* process received normal text IM */
295 static void _qq_process_recv_normal_im_text(guint8 *data, gint len, qq_recv_normal_im_common *common, PurpleConnection *gc) 251 static void _qq_process_recv_normal_im_text(guint8 *data, gint len, qq_recv_normal_im_common *common, PurpleConnection *gc)
296 { 252 {
308 qd = (qq_data *) gc->proto_data; 264 qd = (qq_data *) gc->proto_data;
309 265
310 /* now it is QQ_NORMAL_IM_TEXT */ 266 /* now it is QQ_NORMAL_IM_TEXT */
311 /* 267 /*
312 if (*cursor >= (data + len - 1)) { 268 if (*cursor >= (data + len - 1)) {
313 purple_debug_warning("QQ", "Received normal IM text is empty\n"); 269 purple_debug(PURPLE_DEBUG_WARNING, "QQ", "Received normal IM text is empty\n");
314 return; 270 return;
315 } else 271 } else
316 */ 272 */
317 im_text = g_newa(qq_recv_normal_im_text, 1); 273 im_text = g_newa(qq_recv_normal_im_text, 1);
318 274
355 qq_add_buddy_by_recv_packet(gc, common->sender_uid, FALSE, TRUE); 311 qq_add_buddy_by_recv_packet(gc, common->sender_uid, FALSE, TRUE);
356 b = purple_find_buddy(gc->account, name); 312 b = purple_find_buddy(gc->account, name);
357 } 313 }
358 qq_b = (b == NULL) ? NULL : (qq_buddy *) b->proto_data; 314 qq_b = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
359 if (qq_b != NULL) { 315 if (qq_b != NULL) {
360 qq_b->client_version = common->sender_ver; 316 qq_b->client_version = common->sender_ver;
361 } 317 }
362 318
363 purple_msg_type = (im_text->msg_type == QQ_IM_AUTO_REPLY) ? PURPLE_MESSAGE_AUTO_RESP : 0; 319 purple_msg_type = (im_text->msg_type == QQ_IM_AUTO_REPLY) ? PURPLE_MESSAGE_AUTO_RESP : 0;
364 320
365 msg_with_purple_smiley = qq_smiley_to_purple(im_text->msg); 321 msg_with_purple_smiley = qq_smiley_to_purple(im_text->msg);
366 msg_utf8_encoded = im_text->is_there_font_attr ? 322 msg_utf8_encoded = im_text->is_there_font_attr ?
367 qq_encode_to_purple(im_text->font_attr, 323 qq_encode_to_purple(im_text->font_attr,
392 348
393 common = g_newa (qq_recv_normal_im_common, 1); 349 common = g_newa (qq_recv_normal_im_common, 1);
394 350
395 bytes = _qq_normal_im_common_read(data, len, common); 351 bytes = _qq_normal_im_common_read(data, len, common);
396 if (bytes < 0) { 352 if (bytes < 0) {
397 purple_debug_error("QQ", "Fail read the common part of normal IM\n"); 353 purple_debug (PURPLE_DEBUG_ERROR, "QQ",
354 "Fail read the common part of normal IM\n");
398 return; 355 return;
399 } 356 }
400 357
401 switch (common->normal_im_type) { 358 switch (common->normal_im_type) {
402 case QQ_NORMAL_IM_TEXT: 359 case QQ_NORMAL_IM_TEXT:
403 purple_debug_info("QQ", 360 purple_debug (PURPLE_DEBUG_INFO, "QQ",
404 "Normal IM, text type:\n [%d] => [%d], src: %s (%04X)\n", 361 "Normal IM, text type:\n [%d] => [%d], src: %s (%04X)\n",
405 common->sender_uid, common->receiver_uid, 362 common->sender_uid, common->receiver_uid,
406 qq_get_ver_desc (common->sender_ver), common->sender_ver); 363 qq_get_ver_desc (common->sender_ver), common->sender_ver);
407 if (bytes >= len - 1) { 364 if (bytes >= len - 1) {
408 purple_debug_warning("QQ", "Received normal IM text is empty\n"); 365 purple_debug(PURPLE_DEBUG_WARNING, "QQ", "Received normal IM text is empty\n");
409 return; 366 return;
410 } 367 }
411 _qq_process_recv_normal_im_text(data + bytes, len - bytes, common, gc); 368 _qq_process_recv_normal_im_text(data + bytes, len - bytes, common, gc);
412 break; 369 break;
413 case QQ_NORMAL_IM_FILE_REJECT_UDP: 370 case QQ_NORMAL_IM_FILE_REJECT_UDP:
422 case QQ_NORMAL_IM_FILE_CANCEL: 379 case QQ_NORMAL_IM_FILE_CANCEL:
423 qq_process_recv_file_cancel(data + bytes, len - bytes, common->sender_uid, gc); 380 qq_process_recv_file_cancel(data + bytes, len - bytes, common->sender_uid, gc);
424 break; 381 break;
425 case QQ_NORMAL_IM_FILE_NOTIFY: 382 case QQ_NORMAL_IM_FILE_NOTIFY:
426 qq_process_recv_file_notify(data + bytes, len - bytes, common->sender_uid, gc); 383 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);
461 break; 384 break;
462 default: 385 default:
463 im_unprocessed = g_newa (qq_recv_normal_im_unprocessed, 1); 386 im_unprocessed = g_newa (qq_recv_normal_im_unprocessed, 1);
464 im_unprocessed->common = common; 387 im_unprocessed->common = common;
465 im_unprocessed->unknown = data + bytes; 388 im_unprocessed->unknown = data + bytes;
466 im_unprocessed->length = len - bytes; 389 im_unprocessed->length = len - bytes;
467 /* a simple process here, maybe more later */ 390 /* a simple process here, maybe more later */
468 purple_debug_warning("QQ", 391 purple_debug (PURPLE_DEBUG_WARNING, "QQ",
469 "Normal IM, unprocessed type [0x%04x], len %d\n", 392 "Normal IM, unprocessed type [0x%04x], len %d\n",
470 common->normal_im_type, im_unprocessed->length); 393 common->normal_im_type, im_unprocessed->length);
471 qq_show_packet ("QQ", im_unprocessed->unknown, im_unprocessed->length); 394 qq_show_packet ("QQ unk-im", im_unprocessed->unknown, im_unprocessed->length);
472 return; 395 return;
473 } 396 }
474 } 397 }
475 398
476 /* process im from system administrator */ 399 /* process im from system administrator */
487 if (NULL == (segments = split_data(data, len, "\x2f", 2))) 410 if (NULL == (segments = split_data(data, len, "\x2f", 2)))
488 return; 411 return;
489 412
490 reply = strtol(segments[0], NULL, 10); 413 reply = strtol(segments[0], NULL, 10);
491 if (reply == QQ_RECV_SYS_IM_KICK_OUT) 414 if (reply == QQ_RECV_SYS_IM_KICK_OUT)
492 purple_debug_warning("QQ", "We are kicked out by QQ server\n"); 415 purple_debug(PURPLE_DEBUG_WARNING, "QQ", "We are kicked out by QQ server\n");
493 msg_utf8 = qq_to_utf8(segments[1], QQ_CHARSET_DEFAULT); 416 msg_utf8 = qq_to_utf8(segments[1], QQ_CHARSET_DEFAULT);
494 purple_notify_warning(gc, NULL, _("System Message"), msg_utf8); 417 purple_notify_warning(gc, NULL, _("System Message"), msg_utf8);
495 } 418 }
496 419
497 /* send an IM to to_uid */ 420 /* send an IM to to_uid */
550 if (purple_markup_find_tag("u", msg, &start, &end, &attribs)) { 473 if (purple_markup_find_tag("u", msg, &start, &end, &attribs)) {
551 is_underline = TRUE; 474 is_underline = TRUE;
552 g_datalist_clear(&attribs); 475 g_datalist_clear(&attribs);
553 } 476 }
554 477
555 purple_debug_info("QQ_MESG", "send mesg: %s\n", msg); 478 purple_debug(PURPLE_DEBUG_INFO, "QQ_MESG", "send mesg: %s\n", msg);
556 msg_filtered = purple_markup_strip_html(msg); 479 msg_filtered = purple_markup_strip_html(msg);
557 msg_len = strlen(msg_filtered); 480 msg_len = strlen(msg_filtered);
558 now = time(NULL); 481 now = time(NULL);
559 482
560 font_name_len = (font_name) ? strlen(font_name) : DEFAULT_FONT_NAME_LEN; 483 font_name_len = (font_name) ? strlen(font_name) : DEFAULT_FONT_NAME_LEN;
601 bytes += qq_putdata(raw_data + bytes, send_im_tail, tail_len); 524 bytes += qq_putdata(raw_data + bytes, send_im_tail, tail_len);
602 525
603 qq_show_packet("QQ_raw_data debug", raw_data, bytes); 526 qq_show_packet("QQ_raw_data debug", raw_data, bytes);
604 527
605 if (bytes == raw_len) /* create packet OK */ 528 if (bytes == raw_len) /* create packet OK */
606 qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); 529 qq_send_cmd(qd, QQ_CMD_SEND_IM, raw_data, bytes);
607 else 530 else
608 purple_debug_error("QQ", 531 purple_debug(PURPLE_DEBUG_ERROR, "QQ",
609 "Fail creating send_im packet, expect %d bytes, build %d bytes\n", raw_len, bytes); 532 "Fail creating send_im packet, expect %d bytes, build %d bytes\n", raw_len, bytes);
610 533
611 if (font_color) 534 if (font_color)
612 g_free(font_color); 535 g_free(font_color);
613 if (font_size) 536 if (font_size)
624 g_return_if_fail(data != NULL && data_len != 0); 547 g_return_if_fail(data != NULL && data_len != 0);
625 548
626 qd = gc->proto_data; 549 qd = gc->proto_data;
627 550
628 if (data[0] != QQ_SEND_IM_REPLY_OK) { 551 if (data[0] != QQ_SEND_IM_REPLY_OK) {
629 purple_debug_warning("QQ", "Send IM fail\n"); 552 purple_debug(PURPLE_DEBUG_WARNING, "QQ", "Send IM fail\n");
630 purple_notify_error(gc, _("Error"), _("Failed to send IM."), NULL); 553 purple_notify_error(gc, _("Error"), _("Failed to send IM."), NULL);
631 } else { 554 } else {
632 purple_debug_info("QQ", "IM ACK OK\n"); 555 purple_debug(PURPLE_DEBUG_INFO, "QQ", "IM ACK OK\n");
633 } 556 }
634 } 557 }
635 558
636 /* I receive a message, mainly it is text msg, 559 /* I receive a message, mainly it is text msg,
637 * but we need to proess other types (group etc) */ 560 * but we need to proess other types (group etc) */
644 g_return_if_fail(data != NULL && data_len != 0); 567 g_return_if_fail(data != NULL && data_len != 0);
645 568
646 qd = (qq_data *) gc->proto_data; 569 qd = (qq_data *) gc->proto_data;
647 570
648 if (data_len < 16) { /* we need to ack with the first 16 bytes */ 571 if (data_len < 16) { /* we need to ack with the first 16 bytes */
649 purple_debug_error("QQ", "MSG is too short\n"); 572 purple_debug(PURPLE_DEBUG_ERROR, "QQ", "IM is too short\n");
650 return; 573 return;
651 } else { 574 } else {
652 /* when we receive a message, 575 _qq_send_packet_recv_im_ack(gc, seq, data);
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);
655 } 576 }
656 577
657 /* check len first */ 578 /* check len first */
658 if (data_len < 20) { /* length of im_header */ 579 if (data_len < 20) { /* length of im_header */
659 purple_debug_error("QQ", "Invald MSG header, len %d < 20\n", data_len); 580 purple_debug(PURPLE_DEBUG_ERROR, "QQ",
581 "Fail read recv IM header, len should longer than 20 bytes, read %d bytes\n", data_len);
660 return; 582 return;
661 } 583 }
662 584
663 bytes = 0; 585 bytes = 0;
664 im_header = g_newa(qq_recv_im_header, 1); 586 im_header = g_newa(qq_recv_im_header, 1);
670 bytes += qq_get16(&(im_header->sender_port), data + bytes); 592 bytes += qq_get16(&(im_header->sender_port), data + bytes);
671 bytes += qq_get16(&(im_header->im_type), data + bytes); 593 bytes += qq_get16(&(im_header->im_type), data + bytes);
672 /* im_header prepared */ 594 /* im_header prepared */
673 595
674 if (im_header->receiver_uid != qd->uid) { /* should not happen */ 596 if (im_header->receiver_uid != qd->uid) { /* should not happen */
675 purple_debug_error("QQ", "MSG to [%d], NOT me\n", im_header->receiver_uid); 597 purple_debug(PURPLE_DEBUG_ERROR, "QQ", "IM to [%d], NOT me\n", im_header->receiver_uid);
676 return; 598 return;
677 } 599 }
678 600
679 /* check bytes */ 601 /* check bytes */
680 if (bytes >= data_len - 1) { 602 if (bytes >= data_len - 1) {
681 purple_debug_warning("QQ", "Empty MSG\n"); 603 purple_debug (PURPLE_DEBUG_WARNING, "QQ", "Received IM is empty\n");
682 return; 604 return;
683 } 605 }
684 606
685 switch (im_header->im_type) { 607 switch (im_header->im_type) {
686 case QQ_RECV_IM_NEWS: 608 case QQ_RECV_IM_TO_BUDDY:
687 _qq_process_recv_news(data + bytes, data_len - bytes, gc); 609 purple_debug(PURPLE_DEBUG_INFO, "QQ",
688 break; 610 "IM from buddy [%d], I am in his/her buddy list\n", im_header->sender_uid);
689 case QQ_RECV_IM_FROM_BUDDY_2006: 611 _qq_process_recv_normal_im(data + bytes, data_len - bytes, gc); /* position and rest length */
690 case QQ_RECV_IM_FROM_UNKNOWN_2006: 612 break;
691 case QQ_RECV_IM_TO_UNKNOWN: 613 case QQ_RECV_IM_TO_UNKNOWN:
692 case QQ_RECV_IM_TO_BUDDY: 614 purple_debug(PURPLE_DEBUG_INFO, "QQ",
693 purple_debug_info("QQ", "MSG from buddy [%d]\n", im_header->sender_uid); 615 "IM from buddy [%d], I am a stranger to him/her\n", im_header->sender_uid);
694 _qq_process_recv_normal_im(data + bytes, data_len - bytes, gc); 616 _qq_process_recv_normal_im(data + bytes, data_len - bytes, gc);
695 break; 617 break;
696 case QQ_RECV_IM_UNKNOWN_QUN_IM: 618 case QQ_RECV_IM_UNKNOWN_QUN_IM:
697 case QQ_RECV_IM_TEMP_QUN_IM: 619 case QQ_RECV_IM_TEMP_QUN_IM:
698 case QQ_RECV_IM_QUN_IM: 620 case QQ_RECV_IM_QUN_IM:
699 purple_debug_info("QQ", "MSG from room [%d]\n", im_header->sender_uid); 621 purple_debug(PURPLE_DEBUG_INFO, "QQ", "IM from group, internal_id [%d]\n", im_header->sender_uid);
700 /* sender_uid is in fact id */ 622 /* sender_uid is in fact id */
701 qq_process_room_msg_normal(data + bytes, data_len - bytes, im_header->sender_uid, gc, im_header->im_type); 623 qq_process_recv_group_im(data + bytes, data_len - bytes, im_header->sender_uid, gc, im_header->im_type);
702 break; 624 break;
703 case QQ_RECV_IM_ADD_TO_QUN: 625 case QQ_RECV_IM_ADD_TO_QUN:
704 purple_debug_info("QQ", "Notice from [%d], Added\n", im_header->sender_uid); 626 purple_debug(PURPLE_DEBUG_INFO, "QQ",
627 "IM from group, added by group internal_id [%d]\n", im_header->sender_uid);
705 /* sender_uid is group id 628 /* sender_uid is group id
706 * we need this to create a dummy group and add to blist */ 629 * we need this to create a dummy group and add to blist */
707 qq_process_room_msg_been_added(data + bytes, data_len - bytes, im_header->sender_uid, gc); 630 qq_process_recv_group_im_been_added(data + bytes, data_len - bytes, im_header->sender_uid, gc);
708 break; 631 break;
709 case QQ_RECV_IM_DEL_FROM_QUN: 632 case QQ_RECV_IM_DEL_FROM_QUN:
710 purple_debug_info("QQ", "Notice from room [%d], Removed\n", im_header->sender_uid); 633 purple_debug(PURPLE_DEBUG_INFO, "QQ",
634 "IM from group, removed by group internal_ID [%d]\n", im_header->sender_uid);
711 /* sender_uid is group id */ 635 /* sender_uid is group id */
712 qq_process_room_msg_been_removed(data + bytes, data_len - bytes, im_header->sender_uid, gc); 636 qq_process_recv_group_im_been_removed(data + bytes, data_len - bytes, im_header->sender_uid, gc);
713 break; 637 break;
714 case QQ_RECV_IM_APPLY_ADD_TO_QUN: 638 case QQ_RECV_IM_APPLY_ADD_TO_QUN:
715 purple_debug_info("QQ", "Notice from room [%d], Joined\n", im_header->sender_uid); 639 purple_debug(PURPLE_DEBUG_INFO, "QQ",
640 "IM from group, apply to join group internal_ID [%d]\n", im_header->sender_uid);
716 /* sender_uid is group id */ 641 /* sender_uid is group id */
717 qq_process_room_msg_apply_join(data + bytes, data_len - bytes, im_header->sender_uid, gc); 642 qq_process_recv_group_im_apply_join(data + bytes, data_len - bytes, im_header->sender_uid, gc);
718 break; 643 break;
719 case QQ_RECV_IM_APPROVE_APPLY_ADD_TO_QUN: 644 case QQ_RECV_IM_APPROVE_APPLY_ADD_TO_QUN:
720 purple_debug_info("QQ", "Notice from room [%d], Confirm add in\n", 645 purple_debug(PURPLE_DEBUG_INFO, "QQ",
646 "IM for group system info, approved by group internal_id [%d]\n",
721 im_header->sender_uid); 647 im_header->sender_uid);
722 /* sender_uid is group id */ 648 /* sender_uid is group id */
723 qq_process_room_msg_been_approved(data + bytes, data_len - bytes, im_header->sender_uid, gc); 649 qq_process_recv_group_im_been_approved(data + bytes, data_len - bytes, im_header->sender_uid, gc);
724 break; 650 break;
725 case QQ_RECV_IM_REJCT_APPLY_ADD_TO_QUN: 651 case QQ_RECV_IM_REJCT_APPLY_ADD_TO_QUN:
726 purple_debug_info("QQ", "Notice from room [%d], Refuse add in\n", 652 purple_debug(PURPLE_DEBUG_INFO, "QQ",
653 "IM for group system info, rejected by group internal_id [%d]\n",
727 im_header->sender_uid); 654 im_header->sender_uid);
728 /* sender_uid is group id */ 655 /* sender_uid is group id */
729 qq_process_room_msg_been_rejected(data + bytes, data_len - bytes, im_header->sender_uid, gc); 656 qq_process_recv_group_im_been_rejected(data + bytes, data_len - bytes, im_header->sender_uid, gc);
730 break; 657 break;
731 case QQ_RECV_IM_SYS_NOTIFICATION: 658 case QQ_RECV_IM_SYS_NOTIFICATION:
732 purple_debug_info("QQ", "Admin notice from [%d]\n", im_header->sender_uid); 659 purple_debug(PURPLE_DEBUG_INFO, "QQ",
660 "IM from [%d], should be a system administrator\n", im_header->sender_uid);
733 _qq_process_recv_sys_im(data + bytes, data_len - bytes, gc); 661 _qq_process_recv_sys_im(data + bytes, data_len - bytes, gc);
734 break; 662 break;
735 default: 663 default:
736 purple_debug_warning("QQ", "MSG from [%d], unknown type %s [0x%02x]\n", 664 purple_debug(PURPLE_DEBUG_WARNING, "QQ",
737 im_header->sender_uid, qq_get_recv_im_type_str(im_header->im_type), 665 "IM from [%d], [0x%02x] %s is not processed\n",
738 im_header->im_type); 666 im_header->sender_uid,
739 qq_show_packet("Unknown MSG type", data, data_len); 667 im_header->im_type, qq_get_recv_im_type_str(im_header->im_type));
740 } 668 }
741 } 669 }
742 670