diff src/protocols/jabber/jabber.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 563fb4f1e9fc
children 7d8da9d4da49
line wrap: on
line diff
--- a/src/protocols/jabber/jabber.c	Fri Jan 20 17:24:54 2006 +0000
+++ b/src/protocols/jabber/jabber.c	Fri Jan 20 20:35:18 2006 +0000
@@ -1001,19 +1001,17 @@
 	return ret;
 }
 
-static char *jabber_tooltip_text(GaimBuddy *b, gboolean full)
+static void jabber_tooltip_text(GaimBuddy *b, GString *str, gboolean full)
 {
 	JabberBuddy *jb;
-	GString *ret;
 
-	g_return_val_if_fail(b != NULL, NULL);
-	g_return_val_if_fail(b->account != NULL, NULL);
-	g_return_val_if_fail(b->account->gc != NULL, NULL);
-	g_return_val_if_fail(b->account->gc->proto_data != NULL, NULL);
+	g_return_if_fail(b != NULL);
+	g_return_if_fail(b->account != NULL);
+	g_return_if_fail(b->account->gc != NULL);
+	g_return_if_fail(b->account->gc->proto_data != NULL);
 
 	jb = jabber_buddy_find(b->account->gc->proto_data, b->name,
 			FALSE);
-	ret = g_string_new("");
 
 	if(jb) {
 		JabberBuddyResource *jbr = NULL;
@@ -1036,7 +1034,7 @@
 				else
 					sub = _("None");
 			}
-			g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Subscription"), sub);
+			g_string_append_printf(str, "\n<b>%s:</b> %s", _("Subscription"), sub);
 		}
 
 		for(l=jb->resources; l; l = l->next) {
@@ -1064,7 +1062,7 @@
 				text = NULL;
 			}
 
-			g_string_append_printf(ret, "\n<b>%s%s:</b> %s%s%s",
+			g_string_append_printf(str, "\n<b>%s%s:</b> %s%s%s",
 					_("Status"),
 					res ? res : "",
 					state,
@@ -1076,12 +1074,10 @@
 		}
 
 		if(!GAIM_BUDDY_IS_ONLINE(b) && jb->error_msg) {
-			g_string_append_printf(ret, "\n<b>%s:</b> %s",
+			g_string_append_printf(str, "\n<b>%s:</b> %s",
 					_("Error"), jb->error_msg);
 		}
 	}
-
-	return g_string_free(ret, FALSE);
 }
 
 static GList *jabber_status_types(GaimAccount *account)