changeset 25799:8d562557ed6f

Some more PurpleBuddy::proto_data related changes. We need a purple_buddy_just_give_me_the_user_set_alias_okay to access PurpleBuddy::alias
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 31 Oct 2008 10:14:23 +0000
parents aa876d48b5b2
children d93c93dfa435
files libpurple/protocols/msn/msn.c libpurple/protocols/msn/user.c libpurple/protocols/msn/userlist.c libpurple/protocols/myspace/myspace.c libpurple/protocols/myspace/user.c libpurple/protocols/oscar/oscar.c libpurple/protocols/silc/buddy.c libpurple/protocols/silc/ops.c
diffstat 8 files changed, 21 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c	Fri Oct 31 09:24:43 2008 +0000
+++ b/libpurple/protocols/msn/msn.c	Fri Oct 31 10:14:23 2008 +0000
@@ -626,7 +626,7 @@
 static const char *
 msn_list_emblems(PurpleBuddy *b)
 {
-	MsnUser *user = b->proto_data;
+	MsnUser *user = purple_buddy_get_protocol_data(b);
 
 	if (user != NULL) {
 		if (user->clientid & MSN_CLIENT_CAP_BOT)
@@ -689,7 +689,7 @@
 	PurplePresence *presence = purple_buddy_get_presence(buddy);
 	PurpleStatus *status = purple_presence_get_active_status(presence);
 
-	user = buddy->proto_data;
+	user = purple_buddy_get_protocol_data(buddy);
 
 	if (purple_presence_is_online(presence))
 	{
@@ -919,7 +919,7 @@
 
 	g_return_val_if_fail(buddy != NULL, NULL);
 
-	user = buddy->proto_data;
+	user = purple_buddy_get_protocol_data(buddy);
 
 	if (user != NULL)
 	{
--- a/libpurple/protocols/msn/user.c	Fri Oct 31 09:24:43 2008 +0000
+++ b/libpurple/protocols/msn/user.c	Fri Oct 31 10:14:23 2008 +0000
@@ -275,9 +275,8 @@
 		b = purple_buddy_new(account, passport, NULL);
 		purple_blist_add_buddy(b, NULL, g, NULL);
 	}
-	b->proto_data = user;
+	purple_buddy_set_protocol_data(b, user);
 	/*Update the blist Node info*/
-//	purple_blist_node_set_string(&(b->node), "", "");
 }
 
 /*check if the msn user is online*/
--- a/libpurple/protocols/msn/userlist.c	Fri Oct 31 09:24:43 2008 +0000
+++ b/libpurple/protocols/msn/userlist.c	Fri Oct 31 10:14:23 2008 +0000
@@ -906,7 +906,7 @@
 				{
 					user = msn_userlist_find_add_user(session->userlist,
 						purple_buddy_get_name(b), NULL);
-					b->proto_data = user;
+					purple_buddy_set_protocol_data(b, user);
 					msn_user_set_op(user, MSN_LIST_FL_OP);
 				}
 			}
--- a/libpurple/protocols/myspace/myspace.c	Fri Oct 31 09:24:43 2008 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Fri Oct 31 10:14:23 2008 +0000
@@ -973,7 +973,7 @@
 
 		buddy = purple_buddy_new(session->account, username, NULL);
 		user->buddy = buddy;
-		buddy->proto_data = (gpointer)user;
+		purple_buddy_set_protocol_data(buddy, (gpointer)user);
 	}
 
 	/* Update user structure with new information */
--- a/libpurple/protocols/myspace/user.c	Fri Oct 31 09:24:43 2008 +0000
+++ b/libpurple/protocols/myspace/user.c	Fri Oct 31 10:14:23 2008 +0000
@@ -57,16 +57,14 @@
 		return NULL;
 	}
 
-	if (!buddy->proto_data) {
+	if (!(user = purple_buddy_get_protocol_data(buddy))) {
 		/* No MsimUser for this buddy; make one. */
 
 		/* TODO: where is this freed? */
 		user = g_new0(MsimUser, 1);
 		user->buddy = buddy;
-		buddy->proto_data = (gpointer)user;
-	} 
-
-	user = (MsimUser *)(buddy->proto_data);
+		purple_buddy_set_protocol_data(buddy, (gpointer)user);
+	}
 
 	return user;
 }
--- a/libpurple/protocols/oscar/oscar.c	Fri Oct 31 09:24:43 2008 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Fri Oct 31 10:14:23 2008 +0000
@@ -4897,7 +4897,7 @@
 				/* node is PurpleBuddy, parent is a PurpleContact.
 				 * We must go two levels up to get the Group */
 				groups = g_list_append(groups,
-						node->parent->parent);
+						purple_buddy_get_group((PurpleBuddy*)node));
 			}
 
 			purple_account_remove_buddies(account, moved_buddies, groups);
--- a/libpurple/protocols/silc/buddy.c	Fri Oct 31 09:24:43 2008 +0000
+++ b/libpurple/protocols/silc/buddy.c	Fri Oct 31 10:14:23 2008 +0000
@@ -689,6 +689,7 @@
 	if (b) {
 		/* See if we have this buddy's public key.  If we do use that
 		   to search the details. */
+		gpointer proto_data;
 		filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key");
 		if (filename) {
 			/* Call WHOIS.  The user info is displayed in the WHOIS
@@ -698,7 +699,7 @@
 			return;
 		}
 
-		if (!b->proto_data) {
+		if (!(proto_data = purple_buddy_get_protocol_data(b))) {
 			g_snprintf(tmp, sizeof(tmp),
 				   _("User %s is not present in the network"), purple_buddy_get_name(b));
 			purple_notify_error(gc, _("User Information"),
@@ -706,7 +707,7 @@
 			return;
 		}
 
-		client_entry = silc_client_get_client_by_id(client, conn, b->proto_data);
+		client_entry = silc_client_get_client_by_id(client, conn, proto_data);
 		if (client_entry) {
 			/* Call WHOIS.  The user info is displayed in the WHOIS
 			   command reply. */
@@ -1277,7 +1278,7 @@
 	/* The client was found.  Now get its public key and verify
 	   that before adding the buddy. */
 	memset(&userpk, 0, sizeof(userpk));
-	b->proto_data = silc_memdup(&client_entry->id, sizeof(client_entry->id));
+	purple_buddy_set_protocol_data(b, silc_memdup(&client_entry->id, sizeof(client_entry->id)));
 	r->client_id = client_entry->id;
 
 	/* Get the public key from attributes, if not present then
@@ -1436,7 +1437,7 @@
 void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy,
 			   PurpleGroup *group)
 {
-	silc_free(buddy->proto_data);
+	silc_free(purple_buddy_get_protocol_data(buddy));
 }
 
 void silcpurple_idle_set(PurpleConnection *gc, int idle)
@@ -1482,7 +1483,7 @@
 	SilcPurple sg = gc->proto_data;
 	SilcClient client = sg->client;
 	SilcClientConnection conn = sg->conn;
-	SilcClientID *client_id = b->proto_data;
+	SilcClientID *client_id = purple_buddy_get_protocol_data(b);
 	SilcClientEntry client_entry;
 	SilcAttributePayload attr;
 	SilcAttributeMood mood = 0;
@@ -1548,7 +1549,7 @@
 	SilcPurple sg = gc->proto_data;
 	SilcClient client = sg->client;
 	SilcClientConnection conn = sg->conn;
-	SilcClientID *client_id = b->proto_data;
+	SilcClientID *client_id = purple_buddy_get_protocol_data(b);
 	SilcClientEntry client_entry;
 	char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr;
 	char tmp[256];
@@ -1658,7 +1659,7 @@
 	pkfile = purple_blist_node_get_string((PurpleBlistNode *) buddy, "public-key");
 	client_entry = silc_client_get_client_by_id(sg->client,
 						    sg->conn,
-						    buddy->proto_data);
+						    purple_buddy_get_protocol_data(buddy));
 
 	if (client_entry &&
 	    silc_client_private_message_key_is_set(sg->client,
--- a/libpurple/protocols/silc/ops.c	Fri Oct 31 09:24:43 2008 +0000
+++ b/libpurple/protocols/silc/ops.c	Fri Oct 31 10:14:23 2008 +0000
@@ -893,9 +893,9 @@
 				}
 			}
 
-			silc_free(b->proto_data);
-			b->proto_data = silc_memdup(&client_entry->id,
-						    sizeof(client_entry->id));
+			silc_free(purple_buddy_get_protocol_data(b));
+			purple_buddy_set_protocol_data(b, silc_memdup(&client_entry->id,
+						    sizeof(client_entry->id)));
 			if (notify == SILC_NOTIFY_TYPE_NICK_CHANGE) {
 				break;
 			} else if (notify == SILC_NOTIFY_TYPE_UMODE_CHANGE) {