changeset 30380:2d4dd38c5db5

Two small fixes Mark suggested: 1. Removed unused parameter in get_buddy_list_type(). 2. Changed oscar_format_buddies() to use GString.
author ivan.komarov@soc.pidgin.im
date Mon, 19 Jul 2010 22:05:38 +0000
parents c5790044f32f
children a347a4cd1caf
files libpurple/protocols/oscar/util.c libpurple/protocols/oscar/visibility.c
diffstat 2 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/util.c	Sun Jul 04 01:13:11 2010 +0000
+++ b/libpurple/protocols/oscar/util.c	Mon Jul 19 22:05:38 2010 +0000
@@ -392,22 +392,20 @@
 oscar_format_buddies(GSList *buddies, const gchar *no_buddies_message)
 {
 	GSList *cur;
-	gchar *result, *tmp;
+	GString *result;
 	if (!buddies) {
 		return g_strdup_printf("<i>%s</i>", no_buddies_message);
 	}
-	result = g_strdup("");
+	result = g_string_new("");
 	for (cur = buddies; cur != NULL; cur = cur->next) {
 		PurpleBuddy *buddy = cur->data;
 		const gchar *bname = purple_buddy_get_name(buddy);
 		const gchar *alias = purple_buddy_get_alias_only(buddy);
+		g_string_append(result, bname);
 		if (alias) {
-			tmp = g_strdup_printf("%s%s (%s)<br>", result, bname, alias);
-		} else {
-			tmp = g_strdup_printf("%s%s<br>", result, bname);
+			g_string_append_printf(result, " (%s)", alias);
 		}
-		g_free(result);
-		result = tmp;
+		g_string_append(result, "<br>");
 	}
-	return result;
+	return g_string_free(result, FALSE);
 }
\ No newline at end of file
--- a/libpurple/protocols/oscar/visibility.c	Sun Jul 04 01:13:11 2010 +0000
+++ b/libpurple/protocols/oscar/visibility.c	Mon Jul 19 22:05:38 2010 +0000
@@ -27,7 +27,7 @@
 #define DONT_APPEAR_OFFLINE	N_("Don't Appear Offline")
 
 static guint16
-get_buddy_list_type(OscarData *od, const char *bname)
+get_buddy_list_type(OscarData *od)
 {
 	PurpleAccount *account = purple_connection_get_account(od->gc);
 	return purple_account_is_status_active(account, OSCAR_STATUS_ID_INVISIBLE) ? AIM_SSI_TYPE_PERMIT : AIM_SSI_TYPE_DENY;
@@ -36,7 +36,7 @@
 static gboolean
 is_buddy_on_list(OscarData *od, const char *bname)
 {
-	return aim_ssi_itemlist_finditem(od->ssi.local, NULL, bname, get_buddy_list_type(od, bname)) != NULL;
+	return aim_ssi_itemlist_finditem(od->ssi.local, NULL, bname, get_buddy_list_type(od)) != NULL;
 }
 
 static void
@@ -45,7 +45,7 @@
 	PurpleBuddy *buddy = PURPLE_BUDDY(node);
 	const char* bname = purple_buddy_get_name(buddy);
 	OscarData *od = purple_connection_get_protocol_data(purple_account_get_connection(purple_buddy_get_account(buddy)));
-	guint16 list_type = get_buddy_list_type(od, bname);
+	guint16 list_type = get_buddy_list_type(od);
 
 	if (!is_buddy_on_list(od, bname)) {
 		aim_ssi_add_to_private_list(od, bname, list_type);