# HG changeset patch # User Christian Hammond # Date 1057201748 0 # Node ID 44b7e2530c0577403bff517f7c7082a1c258faf4 # Parent b77c0feec15015f6ae31df3e10cd0ec0d26d5344 [gaim-migrate @ 6447] Added the Homepage field to the Trepia tooltip, and added a Visit Homepage link to those buddies that have a homepage set. Credit goes to SimGuy. Also, fixed a bug where empty fields in the XML packets weren't causing the values to be set NULL. Rather, they were just empty strings. This caused blank entries in the tooltips and other such annoyances. committer: Tailor Script diff -r b77c0feec150 -r 44b7e2530c05 src/protocols/trepia/trepia.c --- a/src/protocols/trepia/trepia.c Thu Jul 03 03:06:18 2003 +0000 +++ b/src/protocols/trepia/trepia.c Thu Jul 03 03:09:08 2003 +0000 @@ -35,6 +35,7 @@ /* XXX */ #include "gaim.h" #include "multi.h" +#include "ui.h" /* XXX for open_url */ #ifndef _WIN32 # include @@ -485,6 +486,15 @@ text = tmp2; } + if ((value = trepia_profile_get_homepage(profile)) != NULL) { + tmp = g_strdup_printf("Homepage: %s\n", value); + + tmp2 = g_strconcat(text, tmp, NULL); + g_free(tmp); + g_free(text); + text = tmp2; + } + if ((value = trepia_profile_get_profile(profile)) != NULL) { char *escaped_val = g_markup_escape_text(value, -1); @@ -519,6 +529,43 @@ } static void +trepia_visit_homepage(GaimConnection *gc, const char *who) +{ + TrepiaProfile *profile; + struct buddy *b; + const char *value; + + b = gaim_find_buddy(gaim_connection_get_account(gc), who); + profile = b->proto_data; + + if ((value = trepia_profile_get_homepage(profile)) != NULL) + open_url(NULL, value); +} + +static GList * +trepia_buddy_menu(GaimConnection *gc, const char *who) +{ + TrepiaProfile *profile; + struct buddy *b; + const char *value = NULL; + GList *m = NULL; + struct proto_buddy_menu *pbm; + + b = gaim_find_buddy(gaim_connection_get_account(gc), who); + profile = b->proto_data; + + if ((value = trepia_profile_get_homepage(profile)) != NULL) { + pbm = g_new0(struct proto_buddy_menu, 1); + pbm->label = _("Visit Homepage"); + pbm->callback = trepia_visit_homepage; + pbm->gc = gc; + m = g_list_append(m, pbm); + } + + return m; +} + +static void __free_parser_data(gpointer user_data) { #if 0 @@ -574,7 +621,12 @@ buffer = g_string_free(data->buffer, FALSE); data->buffer = NULL; - g_hash_table_insert(data->keys, data->tag, buffer); + if (buffer != NULL) { + if (*buffer != '\0') + g_hash_table_insert(data->keys, data->tag, buffer); + else + free(buffer); + } data->tag = NULL; } @@ -1242,7 +1294,7 @@ trepia_tooltip_text, NULL, trepia_actions, - NULL, + trepia_buddy_menu, NULL, trepia_login, trepia_close,