changeset 5731:7cb2bbf03db5

[gaim-migrate @ 6155] Part of user profiles now appears in the tooltip and under the username. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 04 Jun 2003 04:52:45 +0000
parents 99ae9bd8b5fa
children 37810936887e
files src/protocols/trepia/trepia.c
diffstat 1 files changed, 81 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/trepia/trepia.c	Wed Jun 04 03:57:26 2003 +0000
+++ b/src/protocols/trepia/trepia.c	Wed Jun 04 04:52:45 2003 +0000
@@ -174,13 +174,92 @@
 static char *
 trepia_status_text(struct buddy *b)
 {
+	TrepiaProfile *profile = (TrepiaProfile *)b->proto_data;
+
+	if (trepia_profile_get_profile(profile) != NULL)
+		return g_strdup(trepia_profile_get_profile(profile));
+
 	return NULL;
 }
 
 static char *
 trepia_tooltip_text(struct buddy *b)
 {
-	return NULL;
+	TrepiaProfile *profile = (TrepiaProfile *)b->proto_data;
+	const char *value;
+	const char *first_name, *last_name;
+	int int_value;
+	char *text = NULL;
+	char *tmp, *tmp2;
+	char *c;
+
+	text = g_strdup("");
+
+	first_name = trepia_profile_get_first_name(profile);
+	last_name  = trepia_profile_get_last_name(profile);
+
+	if (first_name != NULL || last_name != NULL) {
+		tmp = g_strdup_printf("<b>Name:</b> %s%s%s\n",
+							  (first_name == NULL ? "" : first_name),
+							  (first_name == NULL ? "" : " "),
+							  (last_name == NULL ? "" : last_name));
+
+		tmp2 = g_strconcat(text, tmp, NULL);
+		g_free(tmp);
+		g_free(text);
+		text = tmp2;
+	}
+
+	if ((int_value = trepia_profile_get_age(profile)) != 0) {
+		tmp = g_strdup_printf("<b>Age:</b> %d\n", int_value);
+
+		tmp2 = g_strconcat(text, tmp, NULL);
+		g_free(tmp);
+		g_free(text);
+		text = tmp2;
+	}
+
+	tmp = g_strdup_printf("<b>Gender:</b> %s\n",
+			(trepia_profile_get_sex(profile) == 'F' ? "Female" : "Male"));
+
+	tmp2 = g_strconcat(text, tmp, NULL);
+	g_free(tmp);
+	g_free(text);
+	text = tmp2;
+
+	if ((value = trepia_profile_get_city(profile)) != NULL) {
+		tmp = g_strdup_printf("<b>City:</b> %s\n", value);
+
+		tmp2 = g_strconcat(text, tmp, NULL);
+		g_free(tmp);
+		g_free(text);
+		text = tmp2;
+	}
+
+	if ((value = trepia_profile_get_state(profile)) != NULL) {
+		tmp = g_strdup_printf("<b>State:</b> %s\n", value);
+
+		tmp2 = g_strconcat(text, tmp, NULL);
+		g_free(tmp);
+		g_free(text);
+		text = tmp2;
+	}
+
+	if ((value = trepia_profile_get_country(profile)) != NULL) {
+		tmp = g_strdup_printf("<b>Country:</b> %s\n", value);
+
+		tmp2 = g_strconcat(text, tmp, NULL);
+		g_free(tmp);
+		g_free(text);
+		text = tmp2;
+	}
+
+	c = text + strlen(text);
+
+	if (*c == '\n')
+		*c = '\0';
+
+	return text;
 }
 
 static GList *
@@ -784,7 +863,7 @@
 	NULL,
 	trepia_list_icon,
 	trepia_list_emblems,
-	NULL,
+	trepia_status_text,
 	trepia_tooltip_text,
 	NULL,
 	NULL,