comparison src/protocols/oscar/oscar.c @ 10498:aba3000cc50a

[gaim-migrate @ 11790] Show available messages in oscar tooltips correctly again. And remove an extra "if (!gaim_status_is_active(status)) return" committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 09 Jan 2005 20:06:25 +0000
parents 659edfcac14e
children 1a97d5e88d12
comparison
equal deleted inserted replaced
10497:e6b87f7e8988 10498:aba3000cc50a
697 static void oscar_string_append_info(GaimConnection *gc, GString *str, const char *newline, GaimBuddy *b, aim_userinfo_t *userinfo) 697 static void oscar_string_append_info(GaimConnection *gc, GString *str, const char *newline, GaimBuddy *b, aim_userinfo_t *userinfo)
698 { 698 {
699 OscarData *od; 699 OscarData *od;
700 GaimAccount *account; 700 GaimAccount *account;
701 GaimPresence *presence; 701 GaimPresence *presence;
702 GaimPresence *buddy_presence; 702 GaimStatus *status;
703 GaimGroup *g = NULL; 703 GaimGroup *g = NULL;
704 struct buddyinfo *bi = NULL; 704 struct buddyinfo *bi = NULL;
705 char *tmp; 705 char *tmp;
706 706
707 od = gc->proto_data; 707 od = gc->proto_data;
708 account = gaim_connection_get_account(gc); 708 account = gaim_connection_get_account(gc);
709 presence = gaim_account_get_presence(account);
710 buddy_presence = gaim_buddy_get_presence(b);
711 709
712 if ((str == NULL) || (newline == NULL) || ((b == NULL) && (userinfo == NULL))) 710 if ((str == NULL) || (newline == NULL) || ((b == NULL) && (userinfo == NULL)))
713 return; 711 return;
714 712
715 if (userinfo == NULL) 713 if (userinfo == NULL)
717 715
718 if (b == NULL) 716 if (b == NULL)
719 b = gaim_find_buddy(account, userinfo->sn); 717 b = gaim_find_buddy(account, userinfo->sn);
720 718
721 if (b != NULL) 719 if (b != NULL)
720 {
722 g = gaim_find_buddys_group(b); 721 g = gaim_find_buddys_group(b);
722 presence = gaim_buddy_get_presence(b);
723 status = gaim_presence_get_active_status(presence);
724 }
723 725
724 if (userinfo != NULL) 726 if (userinfo != NULL)
725 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn)); 727 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn));
726 728
727 if (b != NULL) { 729 if (b != NULL) {
728 if (gaim_presence_is_online(buddy_presence)) { 730 if (gaim_presence_is_online(presence)) {
729 if (aim_sn_is_icq(b->name)) { 731 if (aim_sn_is_icq(b->name)) {
730 tmp = oscar_icqstatus((b->uc & 0xffff0000) >> 16); 732 tmp = oscar_icqstatus((b->uc & 0xffff0000) >> 16);
731 oscar_string_append(str, newline, _("Status"), tmp); 733 oscar_string_append(str, newline, _("Status"), tmp);
732 g_free(tmp); 734 g_free(tmp);
733 } 735 }
764 oscar_string_append(str, newline, _("Buddy Comment"), tmp2); 766 oscar_string_append(str, newline, _("Buddy Comment"), tmp2);
765 g_free(tmp2); 767 g_free(tmp2);
766 } 768 }
767 } 769 }
768 770
769 if ((bi != NULL) && (bi->availmsg != NULL) && gaim_presence_is_available(presence)) { 771 if ((bi != NULL) && (bi->availmsg != NULL) && gaim_status_is_available(status)) {
770 tmp = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); 772 tmp = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg));
771 oscar_string_append(str, newline, _("Available"), tmp); 773 oscar_string_append(str, newline, _("Available"), tmp);
772 g_free(tmp); 774 g_free(tmp);
773 } 775 }
774 } 776 }
5671 status_type = gaim_status_get_type(status); 5673 status_type = gaim_status_get_type(status);
5672 primitive = gaim_status_type_get_primitive(status_type); 5674 primitive = gaim_status_type_get_primitive(status_type);
5673 status_id = gaim_status_get_id(status); 5675 status_id = gaim_status_get_id(status);
5674 presence = gaim_account_get_presence(account); 5676 presence = gaim_account_get_presence(account);
5675 5677
5676 if (!gaim_status_is_active(status)) /* Is this right? I'm confused. */
5677 return;
5678
5679 gaim_debug_info("oscar", "Setting status to %s\n", status_id); 5678 gaim_debug_info("oscar", "Setting status to %s\n", status_id);
5680 5679
5681 if (gc) 5680 if (gc)
5682 od = (OscarData *)gc->proto_data; 5681 od = (OscarData *)gc->proto_data;
5683 5682
5795 { 5794 {
5796 GaimConnection *gc = gaim_account_get_connection(account); 5795 GaimConnection *gc = gaim_account_get_connection(account);
5797 GaimStatusType *type = gaim_status_get_type(status); 5796 GaimStatusType *type = gaim_status_get_type(status);
5798 int primitive = gaim_status_type_get_primitive(type); 5797 int primitive = gaim_status_type_get_primitive(type);
5799 5798
5800 if(!gaim_status_is_active(status)) 5799 if (!gaim_status_is_active(status))
5801 return; 5800 return;
5802 5801
5803 if (primitive == !GAIM_STATUS_OFFLINE && !gc) { 5802 if (primitive == !GAIM_STATUS_OFFLINE && !gc) {
5804 gaim_account_connect(account, status); 5803 gaim_account_connect(account, status);
5805 } else if (primitive == GAIM_STATUS_OFFLINE && gc) { 5804 } else if (primitive == GAIM_STATUS_OFFLINE && gc) {