diff src/buddy.c @ 4722:534eaa4ead94

[gaim-migrate @ 5034] Provided a generic way for prpls to put text in the second line of the Big List and removed a hideous Yahoo! buddy menu hack in the process committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 12 Mar 2003 06:37:40 +0000
parents 91ef4fae4a49
children b9e7ccf21f9c
line wrap: on
line diff
--- a/src/buddy.c	Wed Mar 12 02:27:28 2003 +0000
+++ b/src/buddy.c	Wed Mar 12 06:37:40 2003 +0000
@@ -545,12 +545,14 @@
 {
 	char *name = gaim_get_buddy_alias(b);
 	char *esc = g_markup_escape_text(name, strlen(name)), *text = NULL;
+	struct prpl* prpl = find_prpl(b->account->protocol);
+
 	/* XXX Clean up this crap */
 
 	int ihrs, imin;
-	char *idletime = "";
-	char *warning = idletime;
-	time_t t;
+	char *idletime = NULL, *warning = NULL;
+	const char *statustext = NULL;
+       	time_t t;
 
 	if (!(blist_options & OPT_BLIST_SHOW_ICONS)) {
 		if (b->idle > 0 && blist_options & OPT_BLIST_GREY_IDLERS) {
@@ -567,27 +569,39 @@
 	ihrs = (t - b->idle) / 3600;
 	imin = ((t - b->idle) / 60) % 60;
 
+	if (prpl->status_text) {
+		char *tmp = prpl->status_text(b);
+		if (tmp)
+			statustext = g_markup_escape_text(tmp, strlen(tmp));
+	}
+	
 	if (b->idle) {
 		if (ihrs)
 			idletime = g_strdup_printf(_("Idle (%dh%02dm)"), ihrs, imin);
 		else
 			idletime = g_strdup_printf(_("Idle (%dm)"), imin);
 	}
-
+	
 	if (b->evil > 0)
 		warning = g_strdup_printf(_("Warned (%d%%)"), b->evil);
-
+	
 	if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS)
-		text =  g_strdup_printf("<span color='dim grey'>%s</span>\n<span color='dim grey' size='smaller'>%s %s</span>",
+		text =  g_strdup_printf("<span color='dim grey'>%s</span>\n<span color='dim grey' size='smaller'>%s %s %s</span>",
 					esc,
-					idletime, warning);
+					statustext != NULL ? statustext : "",
+					idletime != NULL ? idletime : "", 
+					warning != NULL ? warning : "");
 	else
-		text = g_strdup_printf("%s\n<span color='dim grey' size='smaller'>%s %s</span>", esc, idletime, warning);
-
-	if (idletime[0])
+		text = g_strdup_printf("%s\n<span color='dim grey' size='smaller'>%s %s %s</span>", esc, 
+				       statustext != NULL ? statustext :  "",
+				       idletime != NULL ? idletime : "", 
+				       warning != NULL ? warning : "");
+	if (idletime)
 		g_free(idletime);
-	if (warning[0])
+	if (warning)
 		g_free(warning);
+	if (statustext)
+		g_free(statustext);
 
 	return text;
 }