gobjectification: ccec64d5: Hid PurpleBuddy members in private

aluink at soc.pidgin.im aluink at soc.pidgin.im
Fri Jul 3 23:00:42 EDT 2009


-----------------------------------------------------------------
Revision: ccec64d5bc8b9689b1e222692ca3245e280527eb
Ancestor: c8c2d3fd12403d62c5188a1d554cd55bd42ab3e8
Author: aluink at soc.pidgin.im
Date: 2009-07-04T02:46:57
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/ccec64d5bc8b9689b1e222692ca3245e280527eb

Modified files:
        libpurple/blist.c libpurple/buddy.c libpurple/buddy.h
        libpurple/contact.c libpurple/group.c
        libpurple/protocols/bonjour/bonjour_ft.c
        libpurple/protocols/jabber/roster.c
        libpurple/protocols/myspace/myspace.c
        libpurple/protocols/oscar/oscar.c
        libpurple/protocols/qq/buddy_memo.c
        libpurple/protocols/silc/buddy.c
        libpurple/protocols/zephyr/zephyr.c pidgin/gtkblist.c
        pidgin/gtkconv.c pidgin/gtkdialogs.c pidgin/gtkpounce.c
        pidgin/gtkutils.c

ChangeLog: 

Hid PurpleBuddy members in private

-------------- next part --------------
============================================================
--- libpurple/blist.c	af93adaeaf889706100d2c0b93bfcc5742451dbc
+++ libpurple/blist.c	b469b39f9cc9a908c834379fa43e4b9bc5dcca85
@@ -428,27 +428,26 @@ void purple_blist_rename_buddy(PurpleBud
 	g_return_if_fail(buddy != NULL);
 
 	hb = g_new(struct _purple_hbuddy, 1);
-	hb->name = g_strdup(purple_normalize(buddy->account, buddy->name));
-	hb->account = buddy->account;
+	hb->name = g_strdup(purple_normalize(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)));
+	hb->account = purple_buddy_get_account(buddy);
 	hb->group = ((PurpleBlistNode *)buddy)->parent->parent;
 	g_hash_table_remove(purplebuddylist->buddies, hb);
 	
-	account_buddies = g_hash_table_lookup(purplebuddylist->buddies_cache, buddy->account);
+	account_buddies = g_hash_table_lookup(purplebuddylist->buddies_cache, purple_buddy_get_account(buddy));
 	g_hash_table_remove(account_buddies, hb);
 
 	g_free(hb->name);
-	hb->name = g_strdup(purple_normalize(buddy->account, name));
+	hb->name = g_strdup(purple_normalize(purple_buddy_get_account(buddy), name));
 	g_hash_table_replace(purplebuddylist->buddies, hb, buddy);
 
 	hb2 = g_new(struct _purple_hbuddy, 1);
 	hb2->name = g_strdup(hb->name);
-	hb2->account = buddy->account;
+	hb2->account = purple_buddy_get_account(buddy);
 	hb2->group = ((PurpleBlistNode *)buddy)->parent->parent;
 
 	g_hash_table_replace(account_buddies, hb2, buddy);
 
-	g_free(buddy->name);
-	buddy->name = g_strdup(name);
+	purple_buddy_set_name(buddy, name);
 
 	purple_blist_schedule_save();
 
@@ -503,27 +502,27 @@ void purple_blist_add_contact(PurpleCont
 				struct _purple_hbuddy *hb, *hb2;
 				
 				hb = g_new(struct _purple_hbuddy, 1);
-				hb->name = g_strdup(purple_normalize(b->account, b->name));
-				hb->account = b->account;
+				hb->name = g_strdup(purple_normalize(purple_buddy_get_account(b), purple_buddy_get_name(b)));
+				hb->account = purple_buddy_get_account(b);
 				hb->group = cnode->parent;
 
 				g_hash_table_remove(purplebuddylist->buddies, hb);
 
-				account_buddies = g_hash_table_lookup(purplebuddylist->buddies_cache, b->account);
+				account_buddies = g_hash_table_lookup(purplebuddylist->buddies_cache, purple_buddy_get_account(b));
 				g_hash_table_remove(account_buddies, hb);
 
-				if (!purple_find_buddy_in_group(b->account, b->name, g)) {
+				if (!purple_find_buddy_in_group(purple_buddy_get_account(b), purple_buddy_get_name(b), g)) {
 					hb->group = gnode;
 					g_hash_table_replace(purplebuddylist->buddies, hb, b);
 
 					hb2 = g_new(struct _purple_hbuddy, 1);
 					hb2->name = g_strdup(hb->name);
-					hb2->account = b->account;
+					hb2->account = purple_buddy_get_account(b);
 					hb2->group = gnode;
 
 					g_hash_table_replace(account_buddies, hb2, b);
 
-					if (purple_account_get_connection(b->account))
+					if (purple_account_get_connection(purple_buddy_get_account(b)))
 						serv_move_buddy(b, (PurpleGroup *)cnode->parent, g);
 				} else {
 					gboolean empty_contact = FALSE;
@@ -532,8 +531,8 @@ void purple_blist_add_contact(PurpleCont
 					 * gonna delete it instead */
 					g_free(hb->name);
 					g_free(hb);
-					if (purple_account_get_connection(b->account))
-						purple_account_remove_buddy(b->account, b, (PurpleGroup *)cnode->parent);
+					if (purple_account_get_connection(purple_buddy_get_account(b)))
+						purple_account_remove_buddy(purple_buddy_get_account(b), b, (PurpleGroup *)cnode->parent);
 
 					if (!cnode->child->next)
 						empty_contact = TRUE;
@@ -735,7 +734,7 @@ void purple_blist_remove_buddy(PurpleBud
 			if (contact->online == 0)
 				group->online--;
 		}
-		if (purple_account_is_connected(buddy->account)) {
+		if (purple_account_is_connected(purple_buddy_get_account(buddy))) {
 			contact->currentsize--;
 			if (contact->currentsize == 0)
 				group->currentsize--;
@@ -753,12 +752,12 @@ void purple_blist_remove_buddy(PurpleBud
 	purple_blist_schedule_save();
 
 	/* Remove this buddy from the buddies hash table */
-	hb.name = g_strdup(purple_normalize(buddy->account, buddy->name));
-	hb.account = buddy->account;
+	hb.name = g_strdup(purple_normalize(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)));
+	hb.account = purple_buddy_get_account(buddy);
 	hb.group = gnode;
 	g_hash_table_remove(purplebuddylist->buddies, &hb);
 
-	account_buddies = g_hash_table_lookup(purplebuddylist->buddies_cache, buddy->account);
+	account_buddies = g_hash_table_lookup(purplebuddylist->buddies_cache, purple_buddy_get_account(buddy));
 	g_hash_table_remove(account_buddies, &hb);
 
 	g_free(hb.name);
@@ -964,7 +963,7 @@ void purple_blist_add_account(PurpleAcco
 				gboolean recompute = FALSE;
 					for (bnode = cnode->child; bnode; bnode = bnode->next) {
 						if (PURPLE_IS_BUDDY(bnode) &&
-								((PurpleBuddy*)bnode)->account == account) {
+								purple_buddy_get_account(PURPLE_BUDDY(bnode)) == account) {
 							recompute = TRUE;
 							((PurpleContact*)cnode)->currentsize++;
 							if (((PurpleContact*)cnode)->currentsize == 1)
@@ -1016,7 +1015,7 @@ void purple_blist_remove_account(PurpleA
 						continue;
 
 					buddy = (PurpleBuddy *)bnode;
-					if (account == buddy->account) {
+					if (account == purple_buddy_get_account(buddy)) {
 						PurplePresence *presence;
 
 						presence = purple_buddy_get_presence(buddy);
@@ -1224,7 +1223,7 @@ void purple_blist_add_buddy(PurpleBuddy 
 			if (((PurpleContact*)bnode->parent)->online == 0)
 				((PurpleGroup*)bnode->parent->parent)->online--;
 		}
-		if (purple_account_is_connected(buddy->account)) {
+		if (purple_account_is_connected(purple_buddy_get_account(buddy))) {
 			((PurpleContact*)bnode->parent)->currentsize--;
 			if (((PurpleContact*)bnode->parent)->currentsize == 0)
 				((PurpleGroup*)bnode->parent->parent)->currentsize--;
@@ -1249,12 +1248,12 @@ void purple_blist_add_buddy(PurpleBuddy 
 
 		if (bnode->parent->parent != (PurpleBlistNode*)g) {
 			hb = g_new(struct _purple_hbuddy, 1);
-			hb->name = g_strdup(purple_normalize(buddy->account, buddy->name));
-			hb->account = buddy->account;
+			hb->name = g_strdup(purple_normalize(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)));
+			hb->account = purple_buddy_get_account(buddy);
 			hb->group = bnode->parent->parent;
 			g_hash_table_remove(purplebuddylist->buddies, hb);
 
-			account_buddies = g_hash_table_lookup(purplebuddylist->buddies_cache, buddy->account);
+			account_buddies = g_hash_table_lookup(purplebuddylist->buddies_cache, purple_buddy_get_account(buddy));
 			g_hash_table_remove(account_buddies, hb);
 
 			g_free(hb->name);
@@ -1290,24 +1289,24 @@ void purple_blist_add_buddy(PurpleBuddy 
 		if (++(PURPLE_CONTACT(bnode->parent)->online) == 1)
 			PURPLE_GROUP(bnode->parent->parent)->online++;
 	}
-	if (purple_account_is_connected(buddy->account)) {
+	if (purple_account_is_connected(purple_buddy_get_account(buddy))) {
 		if (++(PURPLE_CONTACT(bnode->parent)->currentsize) == 1)
 			PURPLE_GROUP(bnode->parent->parent)->currentsize++;
 	}
 	PURPLE_CONTACT(bnode->parent)->totalsize++;
 
 	hb = g_new(struct _purple_hbuddy, 1);
-	hb->name = g_strdup(purple_normalize(buddy->account, buddy->name));
-	hb->account = buddy->account;
+	hb->name = g_strdup(purple_normalize(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)));
+	hb->account = purple_buddy_get_account(buddy);
 	hb->group = ((PurpleBlistNode*)buddy)->parent->parent;
 
 	g_hash_table_replace(purplebuddylist->buddies, hb, buddy);
 
-	account_buddies = g_hash_table_lookup(purplebuddylist->buddies_cache, buddy->account);
+	account_buddies = g_hash_table_lookup(purplebuddylist->buddies_cache, purple_buddy_get_account(buddy));
 
 	hb2 = g_new(struct _purple_hbuddy, 1);
 	hb2->name = g_strdup(hb->name);
-	hb2->account = buddy->account;
+	hb2->account = purple_buddy_get_account(buddy);
 	hb2->group = ((PurpleBlistNode*)buddy)->parent->parent;
 
 	g_hash_table_replace(account_buddies, hb2, buddy);
============================================================
--- libpurple/buddy.c	ed06e344cfc20065425ce5e9074a4ca869fbcbb7
+++ libpurple/buddy.c	3078a1a6e83141ef494ea0b732ea814784a4e86a
@@ -34,6 +34,19 @@ static GObjectClass *parent_class = NULL
 
 static GObjectClass *parent_class = NULL;
 
+struct _PurpleBuddyPrivate {
+	char *name;                             /**< The name of the buddy. */
+	char *alias;                            /**< The user-set alias of the buddy */
+	char *server_alias;                     /**< The server-specified alias of the buddy.  (i.e. MSN "Friendly Names") */
+	void *proto_data;                       /**< This allows the prpl to associate whatever data it wants with a buddy */
+	PurpleBuddyIcon *icon;                    /**< The buddy icon. */
+	PurpleAccount *account;					/**< the account this buddy belongs to */
+	PurplePresence *presence;
+};
+
+struct _PurpleBuddyClass {
+	PurpleBlistNodeClass parent;
+};
 void
 parse_buddy(PurpleGroup *group, PurpleContact *contact, xmlnode *bnode)
 {
@@ -85,6 +98,7 @@ purple_blist_update_buddy_status(PurpleB
 	PurplePresence *presence;
 	PurpleStatus *status;
 	PurpleBlistNode *cnode;
+	PurpleBuddyPrivate *priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
 	g_return_if_fail(buddy != NULL);
 
@@ -92,7 +106,7 @@ purple_blist_update_buddy_status(PurpleB
 	status = purple_presence_get_active_status(presence);
 
 	purple_debug_info("blist", "Updating buddy status for %s (%s)\n",
-			buddy->name, purple_account_get_protocol_name(buddy->account));
+			priv->name, purple_account_get_protocol_name(priv->account));
 
 	if (purple_status_is_online(status) &&
 		!purple_status_is_online(old_status)) {
@@ -144,23 +158,24 @@ void purple_buddy_set_alias(PurpleBuddy 
 	PurpleConversation *conv;
 	char *old_alias;
 	char *new_alias = NULL;
+	PurpleBuddyPrivate *priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
 	g_return_if_fail(buddy != NULL);
 
 	if ((alias != NULL) && (*alias != '\0'))
 		new_alias = purple_utf8_strip_unprintables(alias);
 
-	if (!purple_strings_are_different(buddy->alias, new_alias)) {
+	if (!purple_strings_are_different(priv->alias, new_alias)) {
 		g_free(new_alias);
 		return;
 	}
 
-	old_alias = buddy->alias;
+	old_alias = priv->alias;
 
 	if ((new_alias != NULL) && (*new_alias != '\0'))
-		buddy->alias = g_strdup(alias);
+		priv->alias = g_strdup(alias);
 	else {
-		buddy->alias = NULL;
+		priv->alias = NULL;
 		g_free(new_alias); /* could be "\0" */
 	}
 
@@ -169,8 +184,8 @@ void purple_buddy_set_alias(PurpleBuddy 
 	if (ops && ops->update)
 		ops->update(purplebuddylist, (PurpleBlistNode *)buddy);
 
-	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name,
-											   buddy->account);
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, priv->name,
+											   priv->account);
 	if (conv)
 		purple_conversation_autoset_title(conv);
 
@@ -179,29 +194,43 @@ void purple_buddy_set_alias(PurpleBuddy 
 	g_free(old_alias);
 }
 
+void purple_buddy_set_name(PurpleBuddy *buddy, const char *name)
+{
+	PurpleBuddyPrivate *priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
+	g_return_if_fail(buddy);
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
+
+	if(priv->name)
+		g_free(priv->name);
+
+	priv->name = g_strdup(name);
+
+}
+
 void purple_blist_server_alias_buddy(PurpleBuddy *buddy, const char *alias)
 {
 	PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
 	PurpleConversation *conv;
 	char *old_alias;
 	char *new_alias = NULL;
+	PurpleBuddyPrivate *priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
 	g_return_if_fail(buddy != NULL);
 
 	if ((alias != NULL) && (*alias != '\0') && g_utf8_validate(alias, -1, NULL))
 		new_alias = purple_utf8_strip_unprintables(alias);
 
-	if (!purple_strings_are_different(buddy->server_alias, new_alias)) {
+	if (!purple_strings_are_different(priv->server_alias, new_alias)) {
 		g_free(new_alias);
 		return;
 	}
 
-	old_alias = buddy->server_alias;
+	old_alias = priv->server_alias;
 
 	if ((new_alias != NULL) && (*new_alias != '\0'))
-		buddy->server_alias = new_alias;
+		priv->server_alias = new_alias;
 	else {
-		buddy->server_alias = NULL;
+		priv->server_alias = NULL;
 		g_free(new_alias); /* could be "\0"; */
 	}
 
@@ -210,8 +239,8 @@ void purple_blist_server_alias_buddy(Pur
 	if (ops && ops->update)
 		ops->update(purplebuddylist, (PurpleBlistNode *)buddy);
 
-	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name,
-											   buddy->account);
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, priv->name,
+											   priv->account);
 	if (conv)
 		purple_conversation_autoset_title(conv);
 
@@ -230,12 +259,14 @@ purple_buddy_set_icon(PurpleBuddy *buddy
 void
 purple_buddy_set_icon(PurpleBuddy *buddy, PurpleBuddyIcon *icon)
 {
+	PurpleBuddyPrivate *priv;
 	g_return_if_fail(buddy != NULL);
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
-	if (buddy->icon != icon)
+	if (priv->icon != icon)
 	{
-		purple_buddy_icon_unref(buddy->icon);
-		buddy->icon = (icon != NULL ? purple_buddy_icon_ref(icon) : NULL);
+		purple_buddy_icon_unref(priv->icon);
+		priv->icon = (icon != NULL ? purple_buddy_icon_ref(icon) : NULL);
 	}
 
 	purple_signal_emit(purple_blist_get_handle(), "buddy-icon-changed", buddy);
@@ -246,49 +277,61 @@ purple_buddy_get_account(const PurpleBud
 PurpleAccount *
 purple_buddy_get_account(const PurpleBuddy *buddy)
 {
+	PurpleBuddyPrivate *priv;
 	g_return_val_if_fail(buddy != NULL, NULL);
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
-	return buddy->account;
+	return priv->account;
 }
 
 const char *
 purple_buddy_get_name(const PurpleBuddy *buddy)
 {
+	PurpleBuddyPrivate *priv;
 	g_return_val_if_fail(buddy != NULL, NULL);
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
-	return buddy->name;
+	return priv->name;
 }
 
 PurpleBuddyIcon *
 purple_buddy_get_icon(const PurpleBuddy *buddy)
 {
+	PurpleBuddyPrivate *priv;
 	g_return_val_if_fail(buddy != NULL, NULL);
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
-	return buddy->icon;
+	return priv->icon;
 }
 
 gpointer
 purple_buddy_get_protocol_data(const PurpleBuddy *buddy)
 {
+	PurpleBuddyPrivate *priv;
 	g_return_val_if_fail(buddy != NULL, NULL);
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
-	return buddy->proto_data;
+	return priv->proto_data;
 }
 
 void
 purple_buddy_set_protocol_data(PurpleBuddy *buddy, gpointer data)
 {
+	PurpleBuddyPrivate *priv;
 	g_return_if_fail(buddy != NULL);
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
-	buddy->proto_data = data;
+	priv->proto_data = data;
 }
 
 const char *purple_buddy_get_alias_only(PurpleBuddy *buddy)
 {
+	PurpleBuddyPrivate *priv;
 	g_return_val_if_fail(buddy != NULL, NULL);
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
-	if ((buddy->alias != NULL) && (*buddy->alias != '\0')) {
-		return buddy->alias;
+	if ((priv->alias != NULL) && (*priv->alias != '\0')) {
+		return priv->alias;
 	} else if ((purple_buddy_get_server_alias(buddy) != NULL) &&
 		   (*purple_buddy_get_server_alias(buddy) != '\0')) {
 
@@ -301,13 +344,15 @@ const char *purple_buddy_get_contact_ali
 const char *purple_buddy_get_contact_alias(PurpleBuddy *buddy)
 {
 	PurpleContact *c;
+	PurpleBuddyPrivate *priv;
 
 	g_return_val_if_fail(buddy != NULL, NULL);
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
 	/* Search for an alias for the buddy. In order of precedence: */
 	/* The buddy alias */
-	if (buddy->alias != NULL)
-		return buddy->alias;
+	if (priv->alias != NULL)
+		return priv->alias;
 
 	/* The contact alias */
 	c = purple_buddy_get_contact(buddy);
@@ -319,38 +364,44 @@ const char *purple_buddy_get_contact_ali
 		return purple_buddy_get_server_alias(buddy);
 
 	/* The buddy's user name (i.e. no alias) */
-	return buddy->name;
+	return priv->name;
 }
 
 const char *purple_buddy_get_alias(PurpleBuddy *buddy)
 {
+	PurpleBuddyPrivate *priv;
 	g_return_val_if_fail(buddy != NULL, NULL);
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
 	/* Search for an alias for the buddy. In order of precedence: */
 	/* The buddy alias */
-	if (buddy->alias != NULL)
-		return buddy->alias;
+	if (priv->alias != NULL)
+		return priv->alias;
 
 	/* The server alias */
 	if ((purple_buddy_get_server_alias(buddy)) && (*purple_buddy_get_server_alias(buddy)))
 		return purple_buddy_get_server_alias(buddy);
 
 	/* The buddy's user name (i.e. no alias) */
-	return buddy->name;
+	return priv->name;
 }
 
 const char *purple_buddy_get_local_buddy_alias(PurpleBuddy *buddy)
 {
+	PurpleBuddyPrivate *priv;
 	g_return_val_if_fail(buddy, NULL);
-	return buddy->alias;
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
+	return priv->alias;
 }
 
 const char *purple_buddy_get_server_alias(PurpleBuddy *buddy)
 {
+	PurpleBuddyPrivate *priv;
 	g_return_val_if_fail(buddy != NULL, NULL);
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
-	if ((buddy->server_alias) && (*buddy->server_alias))
-	    return buddy->server_alias;
+	if ((priv->server_alias) && (*priv->server_alias))
+	    return priv->server_alias;
 
 	return NULL;
 }
@@ -358,13 +409,15 @@ const char *purple_buddy_get_local_alias
 const char *purple_buddy_get_local_alias(PurpleBuddy *buddy)
 {
 	PurpleContact *c;
+	PurpleBuddyPrivate *priv;
 
 	g_return_val_if_fail(buddy != NULL, NULL);
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
 	/* Search for an alias for the buddy. In order of precedence: */
 	/* The buddy alias */
-	if (buddy->alias != NULL)
-		return buddy->alias;
+	if (priv->alias != NULL)
+		return priv->alias;
 
 	/* The contact alias */
 	c = purple_buddy_get_contact(buddy);
@@ -372,13 +425,15 @@ const char *purple_buddy_get_local_alias
 		return c->alias;
 
 	/* The buddy's user name (i.e. no alias) */
-	return buddy->name;
+	return priv->name;
 }
 
 PurplePresence *purple_buddy_get_presence(const PurpleBuddy *buddy)
 {
+	PurpleBuddyPrivate *priv;
 	g_return_val_if_fail(buddy != NULL, NULL);
-	return buddy->presence;
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
+	return priv->presence;
 }
 
 xmlnode *
@@ -386,20 +441,22 @@ buddy_to_xmlnode(PurpleBlistNode *bnode)
 {
 	xmlnode *node, *child;
 	PurpleBuddy *buddy;
+	PurpleBuddyPrivate *priv;
 
 	buddy = (PurpleBuddy *)bnode;
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
 	node = xmlnode_new("buddy");
-	xmlnode_set_attrib(node, "account", purple_account_get_username(buddy->account));
-	xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(buddy->account));
+	xmlnode_set_attrib(node, "account", purple_account_get_username(priv->account));
+	xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(priv->account));
 
 	child = xmlnode_new_child(node, "name");
-	xmlnode_insert_data(child, buddy->name, -1);
+	xmlnode_insert_data(child, priv->name, -1);
 
-	if (buddy->alias != NULL)
+	if (priv->alias != NULL)
 	{
 		child = xmlnode_new_child(node, "alias");
-		xmlnode_insert_data(child, buddy->alias, -1);
+		xmlnode_insert_data(child, priv->alias, -1);
 	}
 
 	/* Write buddy settings */
@@ -411,17 +468,12 @@ purple_buddy_set_account(PurpleBuddy *bu
 static void
 purple_buddy_set_account(PurpleBuddy *buddy, PurpleAccount *account)
 {
+	PurpleBuddyPrivate *priv;
 	g_return_if_fail(buddy != NULL);
-	buddy->account = account;
+	priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
+	priv->account = account;
 }
 
-static void
-purple_buddy_set_name(PurpleBuddy *buddy, const char *name)
-{
-	g_return_if_fail(buddy != NULL);
-	buddy->name = g_strdup(name);
-}
-
 /******************/
 /*  GObject Code  */
 /******************/
@@ -455,6 +507,7 @@ purple_buddy_finalize(GObject *object)
 purple_buddy_finalize(GObject *object)
 {
 	PurpleBuddy *buddy = PURPLE_BUDDY(object);
+	PurpleBuddyPrivate *priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 	PurplePlugin *prpl;
 	PurplePluginProtocolInfo *prpl_info;
 
@@ -462,7 +515,7 @@ purple_buddy_finalize(GObject *object)
 	 * Tell the owner PRPL that we're about to free the buddy so it
 	 * can free proto_data
 	 */
-	prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account));
+	prpl = purple_find_prpl(purple_account_get_protocol_id(priv->account));
 	if (prpl) {
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 		if (prpl_info && prpl_info->buddy_free)
@@ -470,11 +523,11 @@ purple_buddy_finalize(GObject *object)
 	}
 
 	/* Delete the node */
-	purple_buddy_icon_unref(buddy->icon);
-	purple_presence_destroy(buddy->presence);
-	g_free(buddy->name);
-	g_free(buddy->alias);
-	g_free(buddy->server_alias);
+	purple_buddy_icon_unref(priv->icon);
+	purple_presence_destroy(priv->presence);
+	g_free(priv->name);
+	g_free(priv->alias);
+	g_free(priv->server_alias);
 
 	PURPLE_DBUS_UNREGISTER_POINTER(buddy);
 
@@ -540,6 +593,8 @@ purple_buddy_class_init(PurpleBuddyClass
 	obj_class->set_property = purple_buddy_set_property;
 	obj_class->get_property = purple_buddy_get_property;
 
+	g_type_class_add_private(klass, sizeof(PurpleBuddyPrivate));
+
 	g_object_class_install_property(obj_class, PROP_ACCOUNT,
 			g_param_spec_string(PROP_ACCOUNT_S, _("Account"),
 				_("The account for the buddy."), NULL,
@@ -562,10 +617,11 @@ purple_buddy_init(GTypeInstance *instanc
 {
 	PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
 	PurpleBuddy *buddy = PURPLE_BUDDY(instance);
+	PurpleBuddyPrivate *priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
 
-	buddy->presence = purple_presence_new_for_buddy(buddy);
+	priv->presence = purple_presence_new_for_buddy(buddy);
 
-	purple_presence_set_status_active(buddy->presence, "offline", TRUE);
+	purple_presence_set_status_active(priv->presence, "offline", TRUE);
 
 	if (ops && ops->new_node)
 		ops->new_node((PurpleBlistNode *)buddy);
============================================================
--- libpurple/buddy.h	9cd2a852c1fc6ca78f003a0d7457a205461a8a77
+++ libpurple/buddy.h	3007df93bd44c25d4b5da6ad32c570f23742d689
@@ -31,6 +31,7 @@ typedef struct _PurpleBuddy PurpleBuddy;
 
 /** @copydoc _PurpleBuddy */
 typedef struct _PurpleBuddy PurpleBuddy;
+typedef struct _PurpleBuddyPrivate PurpleBuddyPrivate;
 typedef struct _PurpleBuddyClass PurpleBuddyClass;
 
 #include "buddyicon.h"
@@ -42,6 +43,7 @@ typedef struct _PurpleBuddyClass PurpleB
 #define PURPLE_BUDDY_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_BUDDY_TYPE, PurpleBuddyClass))
 #define PURPLE_IS_BUDDY_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_BUDDY_TYPE))
 #define PURPLE_GET_BUDDY_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_BUDDY_TYPE, PurpleBuddyClass))
+#define PURPLE_BUDDY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), PURPLE_BUDDY_TYPE, PurpleBuddyPrivate))
 
 #if !(defined PURPLE_HIDE_STRUCTS) || (defined _PURPLE_BUDDY_C_)
 /**
@@ -49,19 +51,8 @@ struct _PurpleBuddy {
  */
 struct _PurpleBuddy {
 	PurpleBlistNode node;                     /**< The node that this buddy inherits from */
-	char *name;                             /**< The name of the buddy. */
-	char *alias;                            /**< The user-set alias of the buddy */
-	char *server_alias;                     /**< The server-specified alias of the buddy.  (i.e. MSN "Friendly Names") */
-	void *proto_data;                       /**< This allows the prpl to associate whatever data it wants with a buddy */
-	PurpleBuddyIcon *icon;                    /**< The buddy icon. */
-	PurpleAccount *account;					/**< the account this buddy belongs to */
-	PurplePresence *presence;
+	PurpleBuddyPrivate *priv;               /**< The private members */
 };
-
-struct _PurpleBuddyClass {
-	PurpleBlistNodeClass parent;
-};
-
 #endif
 
 /**
@@ -138,6 +129,14 @@ const char *purple_buddy_get_name(const 
 const char *purple_buddy_get_name(const PurpleBuddy *buddy);
 
 /**
+ * Set the name of the buddy, frees existing name if not NULL.
+ *
+ * @param buddy The buddy
+ * @param name The name
+ */
+void purple_buddy_set_name(PurpleBuddy *buddy, const char *name);
+
+/**
  * Returns a buddy's icon.
  *
  * @param buddy The buddy.
============================================================
--- libpurple/contact.c	d289e42c9fb5fe825e0b1f489c730f58f6f10abc
+++ libpurple/contact.c	b9a9d3f699f370964407cc3300d045020052370d
@@ -118,10 +118,10 @@ purple_contact_compute_priority_buddy(Pu
 			continue;
 		}
 
-		if (purple_account_is_connected(buddy->account))
+		if (purple_account_is_connected(purple_buddy_get_account(buddy)))
 		{
 			int cmp = 1;
-			if (purple_account_is_connected(new_priority->account))
+			if (purple_account_is_connected(purple_buddy_get_account(new_priority)))
 				cmp = purple_presence_compare(purple_buddy_get_presence(new_priority),
 						purple_buddy_get_presence(buddy));
 
@@ -177,8 +177,8 @@ void purple_blist_alias_contact(PurpleCo
 	{
 		PurpleBuddy *buddy = (PurpleBuddy *)bnode;
 
-		conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name,
-												   buddy->account);
+		conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(buddy),
+												   purple_buddy_get_account(buddy));
 		if (conv)
 			purple_conversation_autoset_title(conv);
 	}
@@ -237,7 +237,7 @@ gboolean purple_contact_on_account(Purpl
 			continue;
 
 		buddy = (PurpleBuddy *)bnode;
-		if (buddy->account == account)
+		if (purple_buddy_get_account(buddy)== account)
 			return TRUE;
 	}
 	return FALSE;
============================================================
--- libpurple/group.c	3a2e36917ff791bf5bf1350e956f9cd8943291f7
+++ libpurple/group.c	17aa6f286fad45ba138f6cbffcfa3913e02e7a58
@@ -175,7 +175,7 @@ void purple_blist_rename_group(PurpleGro
 			for(l = moved_buddies; l; l = l->next) {
 				PurpleBuddy *buddy = (PurpleBuddy *)l->data;
 
-				if(buddy && buddy->account == account)
+				if(buddy && purple_buddy_get_account(buddy)== account)
 					buddies = g_list_append(buddies, (PurpleBlistNode *)buddy);
 			}
 
@@ -216,8 +216,8 @@ GSList *purple_group_get_accounts(Purple
 		} else if (PURPLE_IS_CONTACT(cnode)) {
 			for (bnode = cnode->child; bnode; bnode = bnode->next) {
 				if (PURPLE_IS_BUDDY(bnode)) {
-					if (!g_slist_find(l, ((PurpleBuddy *)bnode)->account))
-						l = g_slist_append(l, ((PurpleBuddy *)bnode)->account);
+					if (!g_slist_find(l, purple_buddy_get_account(PURPLE_BUDDY(bnode))))
+						l = g_slist_append(l, purple_buddy_get_account(PURPLE_BUDDY(bnode)));
 				}
 			}
 		}
============================================================
--- libpurple/protocols/bonjour/bonjour_ft.c	784f1ebc42d4a0eb75c0c19d5abdf08a39f3bdec
+++ libpurple/protocols/bonjour/bonjour_ft.c	0bd08db671dd7f3af91ebfe62143597938de791e
@@ -859,7 +859,7 @@ bonjour_bytestreams_connect(PurpleXfer *
 	if(!xf)
 		return;
 
-	p = g_strdup_printf("%s%s%s", xf->sid, pb->name, purple_account_get_username(pb->account));
+	p = g_strdup_printf("%s%s%s", xf->sid, purple_buddy_get_name(pb), purple_account_get_username(purple_buddy_get_account(pb)));
 
 	cipher = purple_sha1_cipher_new();
 	purple_cipher_append(cipher, (guchar *)p, strlen(p));
============================================================
--- libpurple/protocols/jabber/roster.c	4c1b220b093a3df46f2455f7a266ef92c5dd1740
+++ libpurple/protocols/jabber/roster.c	9992fe5f264b817f96a50d6a75f94aa5514cd680
@@ -464,7 +464,7 @@ void jabber_roster_remove_buddy(PurpleCo
 		purple_debug_info("jabber", "jabber_roster_remove_buddy(): Removing %s from %s\n",
 		                  purple_buddy_get_name(buddy), purple_group_get_name(group));
 
-		jabber_roster_update(purple_object_get_protocol_data(PURPLE_OBJECT(gc)), buddy->name, groups);
+		jabber_roster_update(purple_object_get_protocol_data(PURPLE_OBJECT(gc)), purple_buddy_get_name(buddy), groups);
 		g_slist_free(groups);
 	} else {
 		JabberIq *iq = jabber_iq_new_query(purple_object_get_protocol_data(PURPLE_OBJECT(gc)), JABBER_IQ_SET,
============================================================
--- libpurple/protocols/myspace/myspace.c	464d24f954a8834daaf72c39de1e27646d36ede6
+++ libpurple/protocols/myspace/myspace.c	4e0bc11270993ad7fb09931d60a443e8b7434a31
@@ -392,7 +392,7 @@ msim_status_text(PurpleBuddy *buddy)
 
 	account = purple_buddy_get_account(buddy);
 	gc = purple_account_get_connection(account);
-	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(buddy->account)));
+	session = (MsimSession *)purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(purple_buddy_get_account(buddy))));
 
 	g_return_val_if_fail(MSIM_SESSION_VALID(session), NULL);
 
============================================================
--- libpurple/protocols/oscar/oscar.c	3a0780985927357b2b2fbe515da0add7b298ac47
+++ libpurple/protocols/oscar/oscar.c	69294810638f1a73552b87a8a9dfb90d8155db84
@@ -6232,7 +6232,7 @@ static void oscar_buddycb_edit_comment(P
 
 	data = g_new(struct name_data, 1);
 
-	comment = aim_ssi_getcomment(od->ssi.local, g->name, buddy->name);
+	comment = aim_ssi_getcomment(od->ssi.local, g->name, purple_buddy_get_name(buddy));
 	comment_utf8 = comment ? oscar_utf8_try_convert(purple_connection_get_account(gc), comment) : NULL;
 
 	data->gc = gc;
============================================================
--- libpurple/protocols/qq/buddy_memo.c	cb18e314eef4917029d6eefa72103cb0a05ff174
+++ libpurple/protocols/qq/buddy_memo.c	5985401c8ab312e37e32e249f3db43d18919ffe0
@@ -119,7 +119,7 @@ static void update_buddy_memo(PurpleConn
 
 	who = uid_to_purple_name(bd_uid);
 	buddy = purple_find_buddy(account, who);
-	if (buddy == NULL || buddy->proto_data == NULL) {
+	if (buddy == NULL || purple_buddy_get_protocol_data(buddy) == NULL) {
 		g_free(who);
 		purple_debug_info("QQ", "Error...Can NOT find %d!\n", bd_uid);
 		return;
============================================================
--- libpurple/protocols/silc/buddy.c	989316a58b44a0d62b3c5287da427c2232fd19c5
+++ libpurple/protocols/silc/buddy.c	11e5847e672d8a4160bb800706f7ecc515497f24
@@ -1465,8 +1465,7 @@ char *silcpurple_status_text(PurpleBuddy
 char *silcpurple_status_text(PurpleBuddy *b)
 {
 	PurpleAccount *account = purple_buddy_get_account(b);
-	PurpleConnection *gc = purple_account_get_connection(account);
-	SilcPurple sg = purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(b->account)));
+	SilcPurple sg = purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(account)));
 	SilcClient client = sg->client;
 	SilcClientConnection conn = sg->conn;
 	SilcClientID *client_id = purple_buddy_get_protocol_data(b);
@@ -1531,8 +1530,7 @@ void silcpurple_tooltip_text(PurpleBuddy
 void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full)
 {
 	PurpleAccount *account = purple_buddy_get_account(b);
-	PurpleConnection *gc = purple_account_get_connection(account);
-	SilcPurple sg = purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(b->account)));
+	SilcPurple sg = purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(account)));
 	SilcClient client = sg->client;
 	SilcClientConnection conn = sg->conn;
 	SilcClientID *client_id = purple_buddy_get_protocol_data(b);
============================================================
--- libpurple/protocols/zephyr/zephyr.c	5704ab6921232188516084fb8a611293da8a8317
+++ libpurple/protocols/zephyr/zephyr.c	8e56542c0dec563f3adf4058168d0ae907389a68
@@ -812,9 +812,9 @@ static void handle_message(PurpleConnect
 				purple_notify_user_info_destroy(user_info);
 			} else {
 				if (nlocs>0) 
-					purple_prpl_got_user_status(purple_connection_get_account(gc), b ? b->name : user, "available", NULL);
+					purple_prpl_got_user_status(purple_connection_get_account(gc), b ? purple_buddy_get_name(b) : user, "available", NULL);
 				else 
-					purple_prpl_got_user_status(purple_connection_get_account(gc), b ? b->name : user, "offline", NULL);
+					purple_prpl_got_user_status(purple_connection_get_account(gc), b ? purple_buddy_get_name(b) : user, "offline", NULL);
 			}
 
 			g_free(user);
@@ -1194,9 +1194,9 @@ static gint check_notify_tzc(gpointer da
 					purple_notify_user_info_destroy(user_info);
 				} else {
 					if (nlocs>0) 
-						purple_prpl_got_user_status(purple_connection_get_account(gc), b ? b->name : user, "available", NULL);
+						purple_prpl_got_user_status(purple_connection_get_account(gc), b ? purple_buddy_get_name(b) : user, "available", NULL);
 					else 
-						purple_prpl_got_user_status(purple_connection_get_account(gc), b ? b->name : user, "offline", NULL);
+						purple_prpl_got_user_status(purple_connection_get_account(gc), b ? purple_buddy_get_name(b) : user, "offline", NULL);
 				}
 			}
 			else if (!g_ascii_strncasecmp(spewtype,"subscribed",10)) {
============================================================
--- pidgin/gtkblist.c	0897dba15b18a23e983920dcde24e56856470520
+++ pidgin/gtkblist.c	c42c6879ed645609f9d923339401ec7a80076856
@@ -1241,7 +1241,7 @@ static void gtk_blist_row_activated_cb(G
 		else
 			buddy = (PurpleBuddy*)node;
 
-		pidgin_dialogs_im_with_user(buddy->account, buddy->name);
+		pidgin_dialogs_im_with_user(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy));
 	} else if (PURPLE_IS_CHAT(node)) {
 		gtk_blist_join_chat((PurpleChat *)node);
 	} else if (PURPLE_IS_GROUP(node)) {
@@ -1490,7 +1490,7 @@ pidgin_blist_make_buddy_menu(GtkWidget *
 	g_return_if_fail(menu);
 	g_return_if_fail(buddy);
 
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(purple_account_get_connection(buddy->account)));
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(purple_account_get_connection(purple_buddy_get_account(buddy))));
 
 	node = (PurpleBlistNode*)buddy;
 
@@ -1531,7 +1531,7 @@ pidgin_blist_make_buddy_menu(GtkWidget *
 	
 	if (prpl_info && prpl_info->send_file) {
 		if (!prpl_info->can_receive_file ||
-			prpl_info->can_receive_file(purple_account_get_connection(buddy->account), buddy->name))
+			prpl_info->can_receive_file(purple_account_get_connection(purple_buddy_get_account(buddy)), purple_buddy_get_name(buddy)))
 		{
 			pidgin_new_item_from_stock(menu, _("_Send File..."),
 									 PIDGIN_STOCK_TOOLBAR_SEND_FILE,
@@ -1559,7 +1559,7 @@ pidgin_blist_make_buddy_menu(GtkWidget *
 				NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node, 0, 0, NULL);
 	}
 
-	pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(buddy->account), node);
+	pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(purple_buddy_get_account(buddy)), node);
 	pidgin_append_blist_node_extended_menu(menu, node);
 
 	if (!contact_expanded && contact != NULL)
@@ -1616,7 +1616,7 @@ gtk_blist_key_press_cb(GtkWidget *tv, Gd
 			return FALSE;
 		}
 		if(buddy)
-			pidgin_retrieve_user_info(purple_account_get_connection(buddy->account), buddy->name);
+			pidgin_retrieve_user_info(purple_account_get_connection(purple_buddy_get_account(buddy)), purple_buddy_get_name(buddy));
 	} else {
 		switch (event->keyval) {
 			case GDK_F2:
@@ -1855,13 +1855,13 @@ create_buddy_menu(PurpleBlistNode *node,
 
 				if(buddy == b)
 					continue;
-				if(!purple_account_get_connection(buddy->account))
+				if(!purple_account_get_connection(purple_buddy_get_account(buddy)))
 					continue;
 				if(!show_offline && !PURPLE_BUDDY_IS_ONLINE(buddy))
 					continue;
 
-				menuitem = gtk_image_menu_item_new_with_label(buddy->name);
-				buf = pidgin_create_prpl_icon(buddy->account,PIDGIN_PRPL_ICON_SMALL);
+				menuitem = gtk_image_menu_item_new_with_label(purple_buddy_get_name(buddy));
+				buf = pidgin_create_prpl_icon(purple_buddy_get_account(buddy),PIDGIN_PRPL_ICON_SMALL);
 				image = gtk_image_new_from_pixbuf(buf);
 				g_object_unref(G_OBJECT(buf));
 				gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem),
@@ -1982,12 +1982,12 @@ gtk_blist_button_press_cb(GtkWidget *tv,
 		else
 			b = (PurpleBuddy *)node;
 
-		prpl = purple_find_prpl(purple_account_get_protocol_id(b->account));
+		prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(b)));
 		if (prpl != NULL)
 			prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
 		if (prpl && prpl_info->get_info)
-			pidgin_retrieve_user_info(purple_account_get_connection(b->account), b->name);
+			pidgin_retrieve_user_info(purple_account_get_connection(purple_buddy_get_account(b)), purple_buddy_get_name(b));
 		handled = TRUE;
 	}
 
@@ -2324,7 +2324,7 @@ static void pidgin_blist_drag_data_get_c
 			buddy = (PurpleBuddy *)node;
 		}
 
-		gc = purple_account_get_connection(buddy->account);
+		gc = purple_account_get_connection(purple_buddy_get_account(buddy));
 
 		if (gc == NULL)
 		{
@@ -2332,7 +2332,7 @@ static void pidgin_blist_drag_data_get_c
 			return;
 		}
 
-		protocol = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->list_icon(buddy->account, buddy);
+		protocol = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->list_icon(purple_buddy_get_account(buddy), buddy);
 
 		str = g_string_new(NULL);
 		g_string_printf(str,
@@ -2341,13 +2341,13 @@ static void pidgin_blist_drag_data_get_c
 			"X-IM-Protocol: %s\r\n"
 			"X-IM-Username: %s\r\n",
 			protocol,
-			buddy->name);
+			purple_buddy_get_name(buddy));
 
-		if (buddy->alias != NULL)
+		if (purple_buddy_get_alias(buddy) != NULL)
 		{
 			g_string_append_printf(str,
 				"X-IM-Alias: %s\r\n",
-				buddy->alias);
+				purple_buddy_get_alias(buddy));
 		}
 
 		g_string_append(str, "\r\n");
@@ -2642,7 +2642,7 @@ static void pidgin_blist_drag_data_rcv_c
 
 				if (PURPLE_IS_BUDDY(node) || PURPLE_IS_CONTACT(node)) {
 					PurpleBuddy *b = PURPLE_IS_BUDDY(node) ? PURPLE_BUDDY(node) : purple_contact_get_priority_buddy(PURPLE_CONTACT(node));
-					pidgin_dnd_file_manage(sd, b->account, b->name);
+					pidgin_dnd_file_manage(sd, purple_buddy_get_account(b), purple_buddy_get_name(b));
 					gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
 				} else {
 					gtk_drag_finish(dc, FALSE, FALSE, t);
@@ -2753,7 +2753,7 @@ static GdkPixbuf *pidgin_blist_get_buddy
 	if (data == NULL) {
 		if (buddy) {
 			/* Not sure I like this...*/
-			if (!(icon = purple_buddy_icons_find(buddy->account, buddy->name)))
+			if (!(icon = purple_buddy_icons_find(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy))))
 				return NULL;
 			data = purple_buddy_icon_get_data(icon, &len);
 		}
@@ -2924,7 +2924,7 @@ static struct tooltip_data * create_tip_
 	char *tmp = NULL, *node_name = NULL, *tooltip_text = NULL;
 
 	if (PURPLE_IS_BUDDY(node)) {
-		account = ((PurpleBuddy*)(node))->account;
+		account = purple_buddy_get_account(PURPLE_BUDDY(node));
 	} else if (PURPLE_IS_CHAT(node)) {
 		account = ((PurpleChat*)(node))->account;
 	}
@@ -3272,8 +3272,8 @@ static gboolean buddy_is_displayable(Pur
 
 	gtknode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy));
 
-	return (purple_account_is_connected(buddy->account) &&
-			(purple_presence_is_online(buddy->presence) ||
+	return (purple_account_is_connected(purple_buddy_get_account(buddy)) &&
+			(purple_presence_is_online(purple_buddy_get_presence(buddy)) ||
 			 (gtknode && gtknode->recent_signonoff) ||
 			 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies") ||
 			 purple_blist_node_get_bool((PurpleBlistNode*)buddy, "show_offline")));
@@ -3565,7 +3565,7 @@ static char *pidgin_get_tooltip_text(Pur
 			c = purple_buddy_get_contact(b);
 		}
 
-		prpl = purple_find_prpl(purple_account_get_protocol_id(b->account));
+		prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(b)));
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
 		presence = purple_buddy_get_presence(b);
@@ -3584,11 +3584,11 @@ static char *pidgin_get_tooltip_text(Pur
 		/* Alias */
 		/* If there's not a contact alias, the node is being displayed with
 		 * this alias, so there's no point in showing it in the tooltip. */
-		if (full && c && b->alias != NULL && b->alias[0] != '\0' &&
+		if (full && c && purple_buddy_get_alias(b)!= NULL && purple_buddy_get_alias(b)[0] != '\0' &&
 		    (c->alias != NULL && c->alias[0] != '\0') &&
-		    strcmp(c->alias, b->alias) != 0)
+		    strcmp(c->alias, purple_buddy_get_alias(b)) != 0)
 		{
-			tmp = g_markup_escape_text(b->alias, -1);
+			tmp = g_markup_escape_text(purple_buddy_get_alias(b), -1);
 			purple_notify_user_info_add_pair(user_info, _("Buddy Alias"), tmp);
 			g_free(tmp);
 		}
@@ -3598,9 +3598,9 @@ static char *pidgin_get_tooltip_text(Pur
 		 * alias, but many people on MSN set long nicknames, which
 		 * get ellipsized, so the only way to see the whole thing is
 		 * to look at the tooltip. */
-		if (full && b->server_alias != NULL && b->server_alias[0] != '\0')
+		if (full && purple_buddy_get_alias(b)!= NULL && purple_buddy_get_server_alias(b)[0] != '\0')
 		{
-			tmp = g_markup_escape_text(b->server_alias, -1);
+			tmp = g_markup_escape_text(purple_buddy_get_server_alias(b), -1);
 			purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp);
 			g_free(tmp);
 		}
@@ -3676,7 +3676,7 @@ static char *pidgin_get_tooltip_text(Pur
 			purple_notify_user_info_add_pair(user_info, _("Status"), _("Offline"));
 		}
 
-		if (purple_account_is_connected(b->account) &&
+		if (purple_account_is_connected(purple_buddy_get_account(b)) &&
 				prpl_info && prpl_info->tooltip_text)
 		{
 			/* Additional text from the PRPL */
@@ -3684,13 +3684,13 @@ static char *pidgin_get_tooltip_text(Pur
 		}
 
 		/* These are Easter Eggs.  Patches to remove them will be rejected. */
-		if (!g_ascii_strcasecmp(b->name, "robflynn"))
+		if (!g_ascii_strcasecmp(purple_buddy_get_name(b), "robflynn"))
 			purple_notify_user_info_add_pair(user_info, _("Description"), _("Spooky"));
-		if (!g_ascii_strcasecmp(b->name, "seanegn"))
+		if (!g_ascii_strcasecmp(purple_buddy_get_name(b), "seanegn"))
 			purple_notify_user_info_add_pair(user_info, _("Status"), _("Awesome"));
-		if (!g_ascii_strcasecmp(b->name, "chipx86"))
+		if (!g_ascii_strcasecmp(purple_buddy_get_name(b), "chipx86"))
 			purple_notify_user_info_add_pair(user_info, _("Status"), _("Rockin'"));
-		if (!g_ascii_strcasecmp(b->name, "grimelite"))
+		if (!g_ascii_strcasecmp(purple_buddy_get_name(b), "grimelite"))
 			purple_notify_user_info_add_pair(user_info, _("Status"), _("Dead"));
 
 		tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n");
@@ -3799,7 +3799,7 @@ pidgin_blist_get_emblem(PurpleBlistNode 
 
 		if (((struct _pidgin_blist_node *)purple_blist_node_get_ui_data(node->parent))->contact_expanded) {
 			if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"))
-				return pidgin_create_prpl_icon(((PurpleBuddy*)node)->account, PIDGIN_PRPL_ICON_SMALL);
+				return pidgin_create_prpl_icon(purple_buddy_get_account(PURPLE_BUDDY(node)), PIDGIN_PRPL_ICON_SMALL);
 		}
 	} else {
 		return NULL;
@@ -3807,7 +3807,7 @@ pidgin_blist_get_emblem(PurpleBlistNode 
 
 	g_return_val_if_fail(buddy != NULL, NULL);
 
-	if (!purple_privacy_check(buddy->account, purple_buddy_get_name(buddy))) {
+	if (!purple_privacy_check(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy))) {
 		path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emblems", "16", "blocked.png", NULL);
 		return _pidgin_blist_get_cached_emblem(path);
 	}
@@ -3837,7 +3837,7 @@ pidgin_blist_get_emblem(PurpleBlistNode 
 		return _pidgin_blist_get_cached_emblem(path);
 	}
 
-	prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account));
+	prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(buddy)));
 	if (!prpl)
 		return NULL;
 
@@ -3892,7 +3892,7 @@ pidgin_blist_get_status_icon(PurpleBlist
 		PurplePluginProtocolInfo *prpl_info;
 
 		if(buddy)
-			account = buddy->account;
+			account = purple_buddy_get_account(buddy);
 		else
 			account = chat->account;
 
@@ -4028,12 +4028,12 @@ pidgin_blist_get_name_markup(PurpleBuddy
 	if (!aliased || biglist) {
 
 		/* Status Info */
-		prpl = purple_find_prpl(purple_account_get_protocol_id(b->account));
+		prpl = purple_find_prpl(purple_account_get_protocol_id(purple_buddy_get_account(b)));
 
 		if (prpl != NULL)
 			prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
-		if (prpl_info && prpl_info->status_text && purple_account_get_connection(b->account)) {
+		if (prpl_info && prpl_info->status_text && purple_account_get_connection(purple_buddy_get_account(b))) {
 			char *tmp = prpl_info->status_text(b);
 			const char *end;
 
@@ -6158,7 +6158,7 @@ static gboolean pidgin_blist_group_has_s
 		if(PURPLE_IS_CONTACT(cnode)) {
 			for(bnode = cnode->child; bnode; bnode = bnode->next) {
 				PurpleBuddy *buddy = (PurpleBuddy *)bnode;
-				if (purple_account_is_connected(buddy->account) &&
+				if (purple_account_is_connected(purple_buddy_get_account(buddy)) &&
 					purple_blist_node_get_bool(bnode, "show_offline"))
 					return TRUE;
 			}
@@ -6380,7 +6380,7 @@ static void buddy_node(PurpleBuddy *budd
 		}
 	}
 
-	prpl_icon = pidgin_create_prpl_icon(buddy->account, PIDGIN_PRPL_ICON_SMALL);
+	prpl_icon = pidgin_create_prpl_icon(purple_buddy_get_account(buddy), PIDGIN_PRPL_ICON_SMALL);
 
 	if (theme != NULL)
 		color = pidgin_blist_theme_get_contact_color(theme);
@@ -7635,7 +7635,7 @@ static void sort_method_log_activity(Pur
 		PurpleBuddy *buddy;
 		for (n = node->child; n; n = n->next) {
 			buddy = (PurpleBuddy*)n;
-			activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, buddy->name, buddy->account);
+			activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy));
 		}
 		buddy_name = purple_contact_get_alias((PurpleContact*)node);
 	} else if(PURPLE_IS_CHAT(node)) {
@@ -7674,7 +7674,7 @@ static void sort_method_log_activity(Pur
 		if(PURPLE_IS_CONTACT(n)) {
 			for (n2 = n->child; n2; n2 = n2->next) {
                         	buddy = (PurpleBuddy*)n2;
-				this_log_activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, buddy->name, buddy->account);
+				this_log_activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy));
 			}
 			this_buddy_name = purple_contact_get_alias((PurpleContact*)n);
 		} else {
============================================================
--- pidgin/gtkconv.c	61e4eef676f98cf54157cfa8e7d8d0dceee732c4
+++ pidgin/gtkconv.c	93b0d435310d4c5109977e213fc057da0c85d327
@@ -769,7 +769,7 @@ invite_dnd_recv(GtkWidget *widget, GdkDr
 		else
 			return;
 
-		if (strcmp(convprotocol, purple_account_get_protocol_id(buddy->account)))
+		if (strcmp(convprotocol, purple_account_get_protocol_id(purple_buddy_get_account(buddy))))
 		{
 			purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL,
 							  _("That buddy is not on the same protocol as this "
@@ -4375,7 +4375,7 @@ update_chat_alias(PurpleBuddy *buddy, Pu
 	if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
 		return;
 
-	normalized_name = g_strdup(purple_normalize(conv->account, buddy->name));
+	normalized_name = g_strdup(purple_normalize(conv->account, purple_buddy_get_name(buddy)));
 
 	do {
 		char *name;
@@ -4478,7 +4478,7 @@ buddy_cb_common(PurpleBuddy *buddy, Purp
 	if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
 		return;
 
-	normalized_name = g_strdup(purple_normalize(conv->account, buddy->name));
+	normalized_name = g_strdup(purple_normalize(conv->account, purple_buddy_get_name(buddy)));
 
 	do {
 		char *name;
@@ -5148,7 +5148,7 @@ pidgin_conv_find_gtkconv(PurpleConversat
 	for (bn = purple_blist_node_get_first_child(cn); bn; bn = purple_blist_node_get_sibling_next(bn)) {
 		PurpleBuddy *b = PURPLE_BUDDY(bn);
 		PurpleConversation *conv;
-		if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, b->account))) {
+		if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(b), purple_buddy_get_account(b)))) {
 			if (conv->ui_data)
 				return conv->ui_data;
 		}
@@ -7482,7 +7482,7 @@ get_gtkconv_with_contact(PurpleContact *
 	{
 		PurpleBuddy *buddy = (PurpleBuddy*)node;
 		PurpleConversation *conv;
-		conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account);
+		conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy));
 		if (conv)
 			return PIDGIN_CONVERSATION(conv);
 	}
@@ -7531,7 +7531,7 @@ update_buddy_status_timeout(PurpleBuddy 
 	/* To remove the signing-on/off door icon */
 	PurpleConversation *conv;
 
-	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account);
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy));
 	if (conv)
 		pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON);
 
@@ -7577,7 +7577,7 @@ update_buddy_idle_changed(PurpleBuddy *b
 {
 	PurpleConversation *conv;
 
-	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account);
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy));
 	if (conv)
 		pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON);
 }
@@ -7587,7 +7587,7 @@ update_buddy_icon(PurpleBuddy *buddy)
 {
 	PurpleConversation *conv;
 
-	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account);
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy));
 	if (conv)
 		pidgin_conv_update_fields(conv, PIDGIN_CONV_BUDDY_ICON);
 }
============================================================
--- pidgin/gtkdialogs.c	c552da3089476542d95b609fbc23be8b7ec65ca7
+++ pidgin/gtkdialogs.c	02cc257293733aecb7b5a2d4a590014e77244095
@@ -1021,10 +1021,10 @@ pidgin_dialogs_alias_buddy(PurpleBuddy *
 
 	g_return_if_fail(buddy != NULL);
 
-	secondary = g_strdup_printf(_("Enter an alias for %s."), buddy->name);
+	secondary = g_strdup_printf(_("Enter an alias for %s."), purple_buddy_get_name(buddy));
 
 	purple_request_input(NULL, _("Alias Buddy"), NULL,
-					   secondary, buddy->alias, FALSE, FALSE, NULL,
+					   secondary, purple_buddy_get_alias(buddy), FALSE, FALSE, NULL,
 					   _("Alias"), G_CALLBACK(pidgin_dialogs_alias_buddy_cb),
 					   _("Cancel"), NULL,
 					   purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL,
@@ -1063,8 +1063,8 @@ pidgin_dialogs_remove_contact_cb(PurpleC
 	group = (PurpleGroup*)cnode->parent;
 	for (bnode = cnode->child; bnode; bnode = bnode->next) {
 		PurpleBuddy *buddy = (PurpleBuddy*)bnode;
-		if (purple_account_is_connected(buddy->account))
-			purple_account_remove_buddy(buddy->account, buddy, group);
+		if (purple_account_is_connected(purple_buddy_get_account(buddy)))
+			purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group);
 	}
 	purple_blist_remove_contact(contact);
 }
@@ -1090,7 +1090,7 @@ pidgin_dialogs_remove_contact(PurpleCont
 						"You are about to remove the contact containing %s "
 						"and %d other buddies from your buddy list.  Do you "
 						"want to continue?", contact->totalsize - 1),
-					buddy->name, contact->totalsize - 1);
+					purple_buddy_get_name(buddy), contact->totalsize - 1);
 
 		purple_request_action(contact, NULL, _("Remove Contact"), text, 0,
 				NULL, purple_contact_get_alias(contact), NULL,
@@ -1158,8 +1158,8 @@ pidgin_dialogs_remove_group_cb(PurpleGro
 				if (PURPLE_IS_BUDDY(bnode)) {
 					buddy = (PurpleBuddy*)bnode;
 					bnode = bnode->next;
-					if (purple_account_is_connected(buddy->account)) {
-						purple_account_remove_buddy(buddy->account, buddy, group);
+					if (purple_account_is_connected(purple_buddy_get_account(buddy))) {
+						purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group);
 						purple_blist_remove_buddy(buddy);
 					}
 				} else {
@@ -1207,12 +1207,12 @@ pidgin_dialogs_remove_buddy_cb(PurpleBud
 	PurpleAccount *account;
 
 	group = purple_buddy_get_group(buddy);
-	name = g_strdup(buddy->name); /* b->name is a crasher after remove_buddy */
-	account = buddy->account;
+	name = g_strdup(purple_buddy_get_name(buddy)); /* b->name is a crasher after remove_buddy */
+	account = purple_buddy_get_account(buddy);
 
-	purple_debug_info("blist", "Removing '%s' from buddy list.\n", buddy->name);
+	purple_debug_info("blist", "Removing '%s' from buddy list.\n", purple_buddy_get_name(buddy));
 	/* TODO - Should remove from blist first... then call purple_account_remove_buddy()? */
-	purple_account_remove_buddy(buddy->account, buddy, group);
+	purple_account_remove_buddy(purple_buddy_get_account(buddy), buddy, group);
 	purple_blist_remove_buddy(buddy);
 
 	g_free(name);
@@ -1226,7 +1226,7 @@ pidgin_dialogs_remove_buddy(PurpleBuddy 
 	g_return_if_fail(buddy != NULL);
 
 	text = g_strdup_printf(_("You are about to remove %s from your buddy list.  Do you want to continue?"),
-						   buddy->name);
+						   purple_buddy_get_name(buddy));
 
 	purple_request_action(buddy, NULL, _("Remove Buddy"), text, 0,
 						purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), NULL,
============================================================
--- pidgin/gtkpounce.c	782d226bc8c73ff68f13805f55e34989d4fcd2fd
+++ pidgin/gtkpounce.c	06e6cba0bd118960f8f796b07de8cc94545c762a
@@ -430,9 +430,9 @@ pounce_dnd_recv(GtkWidget *widget, GdkDr
 
 		dialog = (PidginPounceDialog *)data;
 
-		gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), buddy->name);
-		dialog->account = buddy->account;
-		pidgin_account_option_menu_set_selected(dialog->account_menu, buddy->account);
+		gtk_entry_set_text(GTK_ENTRY(dialog->buddy_entry), purple_buddy_get_name(buddy));
+		dialog->account = purple_buddy_get_account(buddy);
+		pidgin_account_option_menu_set_selected(dialog->account_menu, purple_buddy_get_account(buddy));
 
 		gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
 	}
============================================================
--- pidgin/gtkutils.c	bfd9769230d0552a3b39a44822568eee0462ff92
+++ pidgin/gtkutils.c	93841c35c6e32978309b39487a41362d61644b10
@@ -2178,9 +2178,9 @@ add_completion_list(PidginCompletionData
 					add_buddyname_autocomplete_entry(data->store,
 														((PurpleContact *)cnode)->alias,
 														purple_buddy_get_contact_alias(entry.entry.buddy),
-														entry.entry.buddy->account,
-														entry.entry.buddy->name
-													 );
+														purple_buddy_get_account(entry.entry.buddy),
+														purple_buddy_get_name(entry.entry.buddy)
+					);
 #else
 					item->data = g_strdup(entry.entry.buddy->name);
 					g_completion_add_items(data->completion, item);
@@ -2322,7 +2322,7 @@ pidgin_screenname_autocomplete_default_f
 	gboolean all = GPOINTER_TO_INT(all_accounts);
 
 	if (completion_entry->is_buddy) {
-		return all || purple_account_is_connected(completion_entry->entry.buddy->account);
+		return all || purple_account_is_connected(purple_buddy_get_account(completion_entry->entry.buddy));
 	} else {
 		return all || (completion_entry->entry.logged_buddy->account != NULL && purple_account_is_connected(completion_entry->entry.logged_buddy->account));
 	}


More information about the Commits mailing list