Mercurial > pidgin
comparison libpurple/protocols/qq/buddy_list.c @ 24091:5f964757f517
2008.09.04 - ccpaging <ccpaging(at)gmail.com>
* minor code cleaned
author | SHiNE CsyFeK <csyfek@gmail.com> |
---|---|
date | Thu, 11 Sep 2008 13:32:26 +0000 |
parents | 2f5a7edd8f68 |
children | 69c218fd5d54 b67eb6f3f026 |
comparison
equal
deleted
inserted
replaced
24089:2f5a7edd8f68 | 24091:5f964757f517 |
---|---|
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_ONLINE_OFFLINE: | 427 case QQ_BUDDY_CHANGE_TO_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_error("QQ", | 559 purple_debug_warning("QQ", "Get status of unknown buddy %d\n", bs.uid); |
560 "got information of unknown buddy %d\n", bs.uid); | |
561 return; | 560 return; |
562 } | 561 } |
563 | 562 |
564 purple_debug_info("QQ", "status:.uid = %d, q_bud->uid = %d\n", bs.uid , q_bud->uid); | |
565 if(bs.ip.s_addr != 0) { | 563 if(bs.ip.s_addr != 0) { |
566 q_bud->ip.s_addr = bs.ip.s_addr; | 564 q_bud->ip.s_addr = bs.ip.s_addr; |
567 q_bud->port = bs.port; | 565 q_bud->port = bs.port; |
568 } | 566 } |
569 q_bud->status =bs.status; | 567 q_bud->status =bs.status; |
570 | 568 |
571 if (q_bud->status == QQ_BUDDY_ONLINE_NORMAL) { | 569 if (q_bud->status == QQ_BUDDY_ONLINE_NORMAL && q_bud->level <= 0) { |
572 qq_request_get_level(gc, q_bud->uid); | 570 qq_request_get_level(gc, q_bud->uid); |
573 } | 571 } |
574 qq_update_buddy_contact(gc, q_bud); | 572 qq_update_buddy_contact(gc, q_bud); |
575 } | 573 } |
576 | 574 |
608 status_id = "offline"; | 606 status_id = "offline"; |
609 break; | 607 break; |
610 case QQ_BUDDY_ONLINE_NORMAL: | 608 case QQ_BUDDY_ONLINE_NORMAL: |
611 status_id = "available"; | 609 status_id = "available"; |
612 break; | 610 break; |
613 case QQ_BUDDY_ONLINE_OFFLINE: | 611 case QQ_BUDDY_CHANGE_TO_OFFLINE: |
614 status_id = "offline"; | 612 status_id = "offline"; |
615 break; | 613 break; |
616 case QQ_BUDDY_ONLINE_AWAY: | 614 case QQ_BUDDY_ONLINE_AWAY: |
617 status_id = "away"; | 615 status_id = "away"; |
618 break; | 616 break; |
630 if (q_bud->comm_flag & QQ_COMM_FLAG_MOBILE && q_bud->status != QQ_BUDDY_OFFLINE) | 628 if (q_bud->comm_flag & QQ_COMM_FLAG_MOBILE && q_bud->status != QQ_BUDDY_OFFLINE) |
631 purple_prpl_got_user_status(gc->account, purple_name, "mobile", NULL); | 629 purple_prpl_got_user_status(gc->account, purple_name, "mobile", NULL); |
632 else | 630 else |
633 purple_prpl_got_user_status_deactive(gc->account, purple_name, "mobile"); | 631 purple_prpl_got_user_status_deactive(gc->account, purple_name, "mobile"); |
634 | 632 |
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 | |
640 g_free(purple_name); | 633 g_free(purple_name); |
641 } | 634 } |
642 | 635 |
643 /* refresh all buddies online/offline, | 636 /* refresh all buddies online/offline, |
644 * after receiving reply for get_buddies_online packet */ | 637 * after receiving reply for get_buddies_online packet */ |
655 | 648 |
656 while (list != NULL) { | 649 while (list != NULL) { |
657 q_bud = (qq_buddy *) list->data; | 650 q_bud = (qq_buddy *) list->data; |
658 if (q_bud != NULL && now > q_bud->last_update + QQ_UPDATE_ONLINE_INTERVAL | 651 if (q_bud != NULL && now > q_bud->last_update + QQ_UPDATE_ONLINE_INTERVAL |
659 && q_bud->status != QQ_BUDDY_ONLINE_INVISIBLE) { | 652 && q_bud->status != QQ_BUDDY_ONLINE_INVISIBLE) { |
660 q_bud->status = QQ_BUDDY_ONLINE_OFFLINE; | 653 q_bud->status = QQ_BUDDY_CHANGE_TO_OFFLINE; |
661 qq_update_buddy_contact(gc, q_bud); | 654 qq_update_buddy_contact(gc, q_bud); |
662 } | 655 } |
663 list = list->next; | 656 list = list->next; |
664 } | 657 } |
665 } | 658 } |