comparison libpurple/protocols/qq/buddy_list.c @ 24112:fb8204e956a1

merge of '6e857412566bb470d069d3f9bfccd5e7828abd0c' and '95a734cf399aa675f3a84219313694d419832a57'
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 15 Sep 2008 03:05:11 +0000
parents 22745e6a3136 b67eb6f3f026
children 5c030dc88356
comparison
equal deleted inserted replaced
24111:a3ac735ae75b 24112:fb8204e956a1
422 switch(status) { 422 switch(status) {
423 case QQ_BUDDY_ONLINE_NORMAL: 423 case QQ_BUDDY_ONLINE_NORMAL:
424 case QQ_BUDDY_ONLINE_AWAY: 424 case QQ_BUDDY_ONLINE_AWAY:
425 case QQ_BUDDY_ONLINE_INVISIBLE: 425 case QQ_BUDDY_ONLINE_INVISIBLE:
426 return TRUE; 426 return TRUE;
427 case QQ_BUDDY_CHANGE_TO_OFFLINE: 427 case QQ_BUDDY_ONLINE_OFFLINE:
428 return FALSE; 428 return FALSE;
429 } 429 }
430 return FALSE; 430 return FALSE;
431 } 431 }
432 432
554 name = uid_to_purple_name(bs.uid); 554 name = uid_to_purple_name(bs.uid);
555 b = purple_find_buddy(gc->account, name); 555 b = purple_find_buddy(gc->account, name);
556 g_free(name); 556 g_free(name);
557 q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data; 557 q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
558 if (q_bud == NULL) { 558 if (q_bud == NULL) {
559 purple_debug_warning("QQ", "Get status of unknown buddy %d\n", bs.uid); 559 purple_debug_error("QQ",
560 "got information of unknown buddy %d\n", bs.uid);
560 return; 561 return;
561 } 562 }
562 563
564 purple_debug_info("QQ", "status:.uid = %d, q_bud->uid = %d\n", bs.uid , q_bud->uid);
563 if(bs.ip.s_addr != 0) { 565 if(bs.ip.s_addr != 0) {
564 q_bud->ip.s_addr = bs.ip.s_addr; 566 q_bud->ip.s_addr = bs.ip.s_addr;
565 q_bud->port = bs.port; 567 q_bud->port = bs.port;
566 } 568 }
567 q_bud->status =bs.status; 569 q_bud->status =bs.status;
568 570
569 if (q_bud->status == QQ_BUDDY_ONLINE_NORMAL && q_bud->level <= 0) { 571 if (q_bud->status == QQ_BUDDY_ONLINE_NORMAL) {
570 qq_request_get_level(gc, q_bud->uid); 572 qq_request_get_level(gc, q_bud->uid);
571 } 573 }
572 qq_update_buddy_contact(gc, q_bud); 574 qq_update_buddy_contact(gc, q_bud);
573 } 575 }
574 576
606 status_id = "offline"; 608 status_id = "offline";
607 break; 609 break;
608 case QQ_BUDDY_ONLINE_NORMAL: 610 case QQ_BUDDY_ONLINE_NORMAL:
609 status_id = "available"; 611 status_id = "available";
610 break; 612 break;
611 case QQ_BUDDY_CHANGE_TO_OFFLINE: 613 case QQ_BUDDY_ONLINE_OFFLINE:
612 status_id = "offline"; 614 status_id = "offline";
613 break; 615 break;
614 case QQ_BUDDY_ONLINE_AWAY: 616 case QQ_BUDDY_ONLINE_AWAY:
615 status_id = "away"; 617 status_id = "away";
616 break; 618 break;
628 if (q_bud->comm_flag & QQ_COMM_FLAG_MOBILE && q_bud->status != QQ_BUDDY_OFFLINE) 630 if (q_bud->comm_flag & QQ_COMM_FLAG_MOBILE && q_bud->status != QQ_BUDDY_OFFLINE)
629 purple_prpl_got_user_status(gc->account, purple_name, "mobile", NULL); 631 purple_prpl_got_user_status(gc->account, purple_name, "mobile", NULL);
630 else 632 else
631 purple_prpl_got_user_status_deactive(gc->account, purple_name, "mobile"); 633 purple_prpl_got_user_status_deactive(gc->account, purple_name, "mobile");
632 634
635 if (q_bud->comm_flag & QQ_COMM_FLAG_VIDEO && q_bud->status != QQ_BUDDY_OFFLINE)
636 purple_prpl_got_user_status(gc->account, purple_name, "video", NULL);
637 else
638 purple_prpl_got_user_status_deactive(gc->account, purple_name, "video");
639
633 g_free(purple_name); 640 g_free(purple_name);
634 } 641 }
635 642
636 /* refresh all buddies online/offline, 643 /* refresh all buddies online/offline,
637 * after receiving reply for get_buddies_online packet */ 644 * after receiving reply for get_buddies_online packet */
648 655
649 while (list != NULL) { 656 while (list != NULL) {
650 q_bud = (qq_buddy *) list->data; 657 q_bud = (qq_buddy *) list->data;
651 if (q_bud != NULL && now > q_bud->last_update + QQ_UPDATE_ONLINE_INTERVAL 658 if (q_bud != NULL && now > q_bud->last_update + QQ_UPDATE_ONLINE_INTERVAL
652 && q_bud->status != QQ_BUDDY_ONLINE_INVISIBLE) { 659 && q_bud->status != QQ_BUDDY_ONLINE_INVISIBLE) {
653 q_bud->status = QQ_BUDDY_CHANGE_TO_OFFLINE; 660 q_bud->status = QQ_BUDDY_ONLINE_OFFLINE;
654 qq_update_buddy_contact(gc, q_bud); 661 qq_update_buddy_contact(gc, q_bud);
655 } 662 }
656 list = list->next; 663 list = list->next;
657 } 664 }
658 } 665 }