diff libpurple/protocols/myspace/myspace.c @ 25374:e22bc87b758b

explicit merge of '9a5e549612efd8ca6f60fc57b51a4eee7e32c861' and 'f398f87ffee8b1b11295a0a0138936074c5dff7a'
author Richard Laager <rlaager@wiktel.com>
date Fri, 02 Jan 2009 22:09:40 +0000
parents 295464ae2d2a f8dbd57cf635
children 212fb65cef7f
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Tue Dec 16 03:35:22 2008 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Fri Jan 02 22:09:40 2009 +0000
@@ -206,7 +206,7 @@
 		/* Next, see if on buddy list and know uid. */
 		buddy = purple_find_buddy(session->account, username);
 		if (buddy) {
-			uid = purple_blist_node_get_int(&buddy->node, "UserID");
+			uid = purple_blist_node_get_int(PURPLE_BLIST_NODE(buddy), "UserID");
 		} else {
 			uid = 0;
 		}
@@ -319,7 +319,7 @@
 		/* See finch/gnthistory.c */
 		buddy = cur->data;
 
-		uid = purple_blist_node_get_int(&buddy->node, "UserID");
+		uid = purple_blist_node_get_int(PURPLE_BLIST_NODE(buddy), "UserID");
 		name = purple_buddy_get_name(buddy);
 
 		if (uid == wanted_uid)
@@ -391,12 +391,17 @@
 	MsimSession *session;
 	MsimUser *user;
 	const gchar *display_name, *headline;
+	PurpleAccount *account;
+	PurpleConnection *gc;
 
 	g_return_val_if_fail(buddy != NULL, NULL);
 
 	user = msim_get_user_from_buddy(buddy);
 
-	session = (MsimSession *)buddy->account->gc->proto_data;
+	account = purple_buddy_get_account(buddy);
+	gc = purple_account_get_connection(account);
+	session = (MsimSession *)gc->proto_data;
+
 	g_return_val_if_fail(MSIM_SESSION_VALID(session), NULL);
 
 	display_name = headline = NULL;
@@ -443,8 +448,10 @@
 
 	if (PURPLE_BUDDY_IS_ONLINE(buddy)) {
 		MsimSession *session;
-
-		session = (MsimSession *)buddy->account->gc->proto_data;
+		PurpleAccount *account = purple_buddy_get_account(buddy);
+		PurpleConnection *gc = purple_account_get_connection(account);
+ 
+		session = (MsimSession *)gc->proto_data;
 
 		g_return_if_fail(MSIM_SESSION_VALID(session));
 
@@ -1025,7 +1032,7 @@
 
 	user->id = uid;
 	/* Keep track of the user ID across sessions */
-	purple_blist_node_set_int(&buddy->node, "UserID", uid);
+	purple_blist_node_set_int(PURPLE_BLIST_NODE(buddy), "UserID", uid);
 
 	/* Stores a few fields in the MsimUser, relevant to the buddy itself.
 	 * AvatarURL, Headline, ContactID. */
@@ -1352,7 +1359,7 @@
 		user->id = msim_msg_get_integer(msg, "f");
 
 		/* Keep track of the user ID across sessions */
-		purple_blist_node_set_int(&buddy->node, "UserID", user->id);
+		purple_blist_node_set_int(PURPLE_BLIST_NODE(buddy), "UserID", user->id);
 
 		msim_store_user_info(session, msg, NULL);
 	} else {
@@ -2566,10 +2573,15 @@
 	MsimMessage *msg;
 	MsimMessage *msg_persist;
 	MsimMessage *body;
+	const char *name, *gname;
+
 
 	session = (MsimSession *)gc->proto_data;
+	name = purple_buddy_get_name(buddy);
+	gname = group ? purple_group_get_name(group) : NULL;
+
 	purple_debug_info("msim", "msim_add_buddy: want to add %s to %s\n",
-			buddy->name, (group && group->name) ? group->name : "(no group)");
+			name, gname ? gname : "(no group)");
 
 	msg = msim_msg_new(
 			"addbuddy", MSIM_TYPE_BOOLEAN, TRUE,
@@ -2578,7 +2590,7 @@
 			"reason", MSIM_TYPE_STRING, g_strdup(""),
 			NULL);
 
-	if (!msim_postprocess_outgoing(session, msg, buddy->name, "newprofileid", "reason")) {
+	if (!msim_postprocess_outgoing(session, msg, name, "newprofileid", "reason")) {
 		purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("'addbuddy' command failed."));
 		msim_msg_free(msg);
 		return;
@@ -2590,7 +2602,7 @@
 
 	body = msim_msg_new(
 			"ContactID", MSIM_TYPE_STRING, g_strdup("<uid>"),
-			"GroupName", MSIM_TYPE_STRING, g_strdup(group->name),
+			"GroupName", MSIM_TYPE_STRING, g_strdup(gname),
 			"Position", MSIM_TYPE_INTEGER, 1000,
 			"Visibility", MSIM_TYPE_INTEGER, 1,
 			"NickName", MSIM_TYPE_STRING, g_strdup(""),
@@ -2611,7 +2623,7 @@
 		"body", MSIM_TYPE_DICTIONARY, body,
 		NULL);
 
-	if (!msim_postprocess_outgoing(session, msg_persist, buddy->name, "body", NULL))
+	if (!msim_postprocess_outgoing(session, msg_persist, name, "body", NULL))
 	{
 		purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("persist command failed"));
 		msim_msg_free(msg_persist);
@@ -2631,8 +2643,10 @@
 	MsimMessage *persist_msg;
 	MsimMessage *blocklist_msg;
 	GList *blocklist_updates;
+	const char *name;
 
 	session = (MsimSession *)gc->proto_data;
+	name = purple_buddy_get_name(buddy);
 
 	delbuddy_msg = msim_msg_new(
 				"delbuddy", MSIM_TYPE_BOOLEAN, TRUE,
@@ -2640,7 +2654,7 @@
 				/* 'delprofileid' with uid will be inserted here. */
 				NULL);
 
-	if (!msim_postprocess_outgoing(session, delbuddy_msg, buddy->name, "delprofileid", NULL)) {
+	if (!msim_postprocess_outgoing(session, delbuddy_msg, name, "delprofileid", NULL)) {
 		purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("'delbuddy' command failed"));
 		msim_msg_free(delbuddy_msg);
 		return;
@@ -2659,7 +2673,7 @@
 			"body", MSIM_TYPE_STRING, g_strdup("ContactID=<uid>"),
 			NULL);
 
-	if (!msim_postprocess_outgoing(session, persist_msg, buddy->name, "body", NULL)) {
+	if (!msim_postprocess_outgoing(session, persist_msg, name, "body", NULL)) {
 		purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("persist command failed"));
 		msim_msg_free(persist_msg);
 		return;
@@ -2681,7 +2695,7 @@
 			"idlist", MSIM_TYPE_LIST, blocklist_updates,
 			NULL);
 
-	if (!msim_postprocess_outgoing(session, blocklist_msg, buddy->name, "idlist", NULL)) {
+	if (!msim_postprocess_outgoing(session, blocklist_msg, name, "idlist", NULL)) {
 		purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("blocklist command failed"));
 		msim_msg_free(blocklist_msg);
 		return;