soc.2010.icq-tlc: cbce1e15: Two small fixes Mark suggested:

ivan.komarov at soc.pidgin.im ivan.komarov at soc.pidgin.im
Sat Jul 24 14:35:52 EDT 2010


----------------------------------------------------------------------
Revision: cbce1e156da7bf637afe5d83fc4dbd66e317f4cb
Parent:   7f7c58ec53c2d4419f78f66bf32c3c444987b621
Author:   ivan.komarov at soc.pidgin.im
Date:     07/19/10 18:05:38
Branch:   im.pidgin.soc.2010.icq-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/cbce1e156da7bf637afe5d83fc4dbd66e317f4cb

Changelog: 

Two small fixes Mark suggested:
  1. Removed unused parameter in get_buddy_list_type().
  2. Changed oscar_format_buddies() to use GString.

Changes against parent 7f7c58ec53c2d4419f78f66bf32c3c444987b621

  patched  libpurple/protocols/oscar/util.c
  patched  libpurple/protocols/oscar/visibility.c

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/util.c	cf81a299a070ccee74cc1112017d57fcb93b2311
+++ libpurple/protocols/oscar/util.c	0076ddaff720c3bd454128dc379f9f1b45b36a0e
@@ -392,22 +392,20 @@ oscar_format_buddies(GSList *buddies, co
 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
============================================================
--- libpurple/protocols/oscar/visibility.c	2fa0497ed474a598202098dd2bce22ec32b02942
+++ libpurple/protocols/oscar/visibility.c	0c3a2b31132d95f421694bf823e74eca26f77c78
@@ -27,7 +27,7 @@ static guint16
 #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 @@ is_buddy_on_list(OscarData *od, const ch
 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 @@ visibility_cb(PurpleBlistNode *node, gpo
 	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);


More information about the Commits mailing list