pidgin.next.minor: af834be8: Some more PurpleBuddy::proto_data relate...

sadrul at pidgin.im sadrul at pidgin.im
Fri Oct 31 06:20:35 EDT 2008


-----------------------------------------------------------------
Revision: af834be8e1d99f849b1cade9138e197d7ddf362a
Ancestor: 8ca9aeb3df19d685ba250c54ec950e4b1a0b5f41
Author: sadrul at pidgin.im
Date: 2008-10-31T10:14:23
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/af834be8e1d99f849b1cade9138e197d7ddf362a

Modified 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

ChangeLog: 

Some more PurpleBuddy::proto_data related changes.

We need a purple_buddy_just_give_me_the_user_set_alias_okay to access
PurpleBuddy::alias

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c	5ccef12e01f57c90945b6b59193f19fb75fdc066
+++ libpurple/protocols/msn/msn.c	cf2b2f8326eaa44e81e6edd36abefd9df6127625
@@ -626,7 +626,7 @@ msn_list_emblems(PurpleBuddy *b)
 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 @@ msn_tooltip_text(PurpleBuddy *buddy, Pur
 	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 @@ msn_buddy_menu(PurpleBuddy *buddy)
 
 	g_return_val_if_fail(buddy != NULL, NULL);
 
-	user = buddy->proto_data;
+	user = purple_buddy_get_protocol_data(buddy);
 
 	if (user != NULL)
 	{
============================================================
--- libpurple/protocols/msn/user.c	6400e7b9b6da1e86d19f1884a1a0775dd5ba8315
+++ libpurple/protocols/msn/user.c	c24e1d79d52671dde81df055d7ce2b0db7098c33
@@ -275,9 +275,8 @@ msn_user_add_group_id(MsnUser *user, con
 		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*/
============================================================
--- libpurple/protocols/msn/userlist.c	7b5fc8b57f2abad6497c7039cdb39509d700bdb2
+++ libpurple/protocols/msn/userlist.c	508f5b24a87f035005518ce79cf7a094433fd478
@@ -906,7 +906,7 @@ msn_userlist_load(MsnSession *session)
 				{
 					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);
 				}
 			}
============================================================
--- libpurple/protocols/myspace/myspace.c	d36af442d0442f864bc5ada49733a6110ab6ce4e
+++ libpurple/protocols/myspace/myspace.c	f1e345c4211c0a3de42d3ae0ff1a3db0bf260473
@@ -973,7 +973,7 @@ msim_get_info_cb(MsimSession *session, M
 
 		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 */
============================================================
--- libpurple/protocols/myspace/user.c	2ccfcc4d56671a671b218410107b68b97268de59
+++ libpurple/protocols/myspace/user.c	f531121a9444f470b8d9c7ffb0928d25e3442eef
@@ -57,17 +57,15 @@ msim_get_user_from_buddy(PurpleBuddy *bu
 		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;
-	} 
+		purple_buddy_set_protocol_data(buddy, (gpointer)user);
+	}
 
-	user = (MsimUser *)(buddy->proto_data);
-
 	return user;
 }
 
============================================================
--- libpurple/protocols/oscar/oscar.c	35db7f8f3b52b82daec4144b3abbe7bea2d8b70d
+++ libpurple/protocols/oscar/oscar.c	b07c8f334e0b3f7f8ebd258ecac3e2a6383b8ed6
@@ -4897,7 +4897,7 @@ void oscar_rename_group(PurpleConnection
 				/* 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);
============================================================
--- libpurple/protocols/silc/buddy.c	89d82bd0c06955d105f754240c0a888fec7b6867
+++ libpurple/protocols/silc/buddy.c	f81cf8c42ed3b892a957670da5828a5339bf2066
@@ -689,6 +689,7 @@ void silcpurple_get_info(PurpleConnectio
 	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 @@ void silcpurple_get_info(PurpleConnectio
 			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 @@ void silcpurple_get_info(PurpleConnectio
 			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 @@ silcpurple_add_buddy_resolved(SilcClient
 	/* 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(PurpleConne
 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 @@ char *silcpurple_status_text(PurpleBuddy
 	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 @@ void silcpurple_tooltip_text(PurpleBuddy
 	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 @@ GList *silcpurple_buddy_menu(PurpleBuddy
 	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,
============================================================
--- libpurple/protocols/silc/ops.c	bf1887d3dac50e06bf1283faf50a068f7a42d54e
+++ libpurple/protocols/silc/ops.c	5241659cdddbc522ee765fdfbacea889da0d7fa5
@@ -893,9 +893,9 @@ silc_notify(SilcClient client, SilcClien
 				}
 			}
 
-			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) {


More information about the Commits mailing list