comparison src/protocols/yahoo/yahoo.c @ 12970:ec9b92104904

[gaim-migrate @ 15323] Pass the tooltip GString to the prpls. This make the prpl tooltip_text consistent with the drawing-tooltip signal callbacks. It also eliminates a little bit of duplicated code from the prpls. It's also theoretically more efficient, but I'm sure the difference is irrelevant. However, this change will allow me to kill a bunch more duplicated code. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Fri, 20 Jan 2006 20:35:18 +0000
parents 6af3ac33eeea
children 6ea877c5a444
comparison
equal deleted inserted replaced
12969:b98a28bf29d9 12970:ec9b92104904
2776 default: 2776 default:
2777 return g_strdup(yahoo_get_status_string(f->status)); 2777 return g_strdup(yahoo_get_status_string(f->status));
2778 } 2778 }
2779 } 2779 }
2780 2780
2781 char *yahoo_tooltip_text(GaimBuddy *b, gboolean full) 2781 void yahoo_tooltip_text(GaimBuddy *b, GString *str, gboolean full)
2782 { 2782 {
2783 YahooFriend *f; 2783 YahooFriend *f;
2784 char *escaped, *status = NULL, *presence = NULL; 2784 char *escaped, *status = NULL, *presence = NULL;
2785 GString *s = g_string_new("");
2786 2785
2787 f = yahoo_friend_find(b->account->gc, b->name); 2786 f = yahoo_friend_find(b->account->gc, b->name);
2788 if (!f) 2787 if (!f)
2789 status = g_strdup_printf("\n%s", _("Not on server list")); 2788 status = g_strdup_printf("\n%s", _("Not on server list"));
2790 else { 2789 else {
2791 switch (f->status) { 2790 switch (f->status) {
2792 case YAHOO_STATUS_CUSTOM: 2791 case YAHOO_STATUS_CUSTOM:
2793 if (!yahoo_friend_get_status_message(f)) 2792 if (!yahoo_friend_get_status_message(f))
2794 return NULL; 2793 return;
2795 status = g_strdup(yahoo_friend_get_status_message(f)); 2794 status = g_strdup(yahoo_friend_get_status_message(f));
2796 break; 2795 break;
2797 case YAHOO_STATUS_OFFLINE: 2796 case YAHOO_STATUS_OFFLINE:
2798 break; 2797 break;
2799 default: 2798 default:
2816 } 2815 }
2817 } 2816 }
2818 2817
2819 if (status != NULL) { 2818 if (status != NULL) {
2820 escaped = g_markup_escape_text(status, strlen(status)); 2819 escaped = g_markup_escape_text(status, strlen(status));
2821 g_string_append_printf(s, _("\n<b>%s:</b> %s"), _("Status"), escaped); 2820 g_string_append_printf(str, _("\n<b>%s:</b> %s"), _("Status"), escaped);
2822 g_free(status); 2821 g_free(status);
2823 g_free(escaped); 2822 g_free(escaped);
2824 } 2823 }
2825 2824
2826 if (presence != NULL) 2825 if (presence != NULL)
2827 g_string_append_printf(s, _("\n<b>%s:</b> %s"), 2826 g_string_append_printf(str, _("\n<b>%s:</b> %s"),
2828 _("Presence"), presence); 2827 _("Presence"), presence);
2829
2830 return g_string_free(s, FALSE);
2831 } 2828 }
2832 2829
2833 static void yahoo_addbuddyfrommenu_cb(GaimBlistNode *node, gpointer data) 2830 static void yahoo_addbuddyfrommenu_cb(GaimBlistNode *node, gpointer data)
2834 { 2831 {
2835 GaimBuddy *buddy; 2832 GaimBuddy *buddy;