diff libpurple/protocols/myspace/myspace.c @ 25377:a4a17fe80160

explicit merge of 'f7807039eeef499a403d638cbcb94060a1d33eea' and '59d53e7606e3c4bd860b9fd6c786f61acf61476b'
author Richard Laager <rlaager@wiktel.com>
date Fri, 02 Jan 2009 22:17:09 +0000
parents 138c729f8c9a 75ecd41a64ba
children 47540809ae91
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Fri Jan 02 22:11:08 2009 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Fri Jan 02 22:17:09 2009 +0000
@@ -1179,7 +1179,6 @@
 			NULL);
 
 	/* Request MySpace info about ourself. */
-	purple_debug_error("MARK", "Fetching info about ourself\n");
 	msim_send(session,
 			"persist", MSIM_TYPE_INTEGER, 1,
 			"sesskey", MSIM_TYPE_INTEGER, session->sesskey,
@@ -2558,7 +2557,7 @@
 	MsimMessage *msg_persist;
 	MsimMessage *body;
 	const char *name, *gname;
-
+	GList *blocklist_updates;
 
 	session = (MsimSession *)gc->proto_data;
 	name = purple_buddy_get_name(buddy);
@@ -2614,6 +2613,27 @@
 		return;
 	}
 	msim_msg_free(msg_persist);
+
+	/* Remove the buddy from our block list and add them to our accept list, I think */
+	blocklist_updates = NULL;
+	blocklist_updates = g_list_prepend(blocklist_updates, "a+");
+	blocklist_updates = g_list_prepend(blocklist_updates, "<uid>");
+	blocklist_updates = g_list_prepend(blocklist_updates, "b-");
+	blocklist_updates = g_list_prepend(blocklist_updates, "<uid>");
+	blocklist_updates = g_list_reverse(blocklist_updates);
+
+	msg = msim_msg_new(
+			"blocklist", MSIM_TYPE_BOOLEAN, TRUE,
+			"sesskey", MSIM_TYPE_INTEGER, session->sesskey,
+			/* TODO: MsimMessage lists. Currently <uid> isn't replaced in lists. */
+			/* "idlist", MSIM_TYPE_STRING, g_strdup("a-|<uid>|b-|<uid>"), */
+			"idlist", MSIM_TYPE_LIST, blocklist_updates,
+			NULL);
+
+	if (!msim_postprocess_outgoing(session, msg, buddy->name, "idlist", NULL))
+		purple_debug_error("myspace", "blocklist command failed\n");
+
+	msim_msg_free(msg);
 }
 
 /**
@@ -2626,8 +2646,8 @@
 	MsimMessage *delbuddy_msg;
 	MsimMessage *persist_msg;
 	MsimMessage *blocklist_msg;
+	const char *name;
 	GList *blocklist_updates;
-	const char *name;
 
 	session = (MsimSession *)gc->proto_data;
 	name = purple_buddy_get_name(buddy);
@@ -2664,6 +2684,7 @@
 	}
 	msim_msg_free(persist_msg);
 
+	/* Remove the buddy from our block list(huh?) and our accept list */
 	blocklist_updates = NULL;
 	blocklist_updates = g_list_prepend(blocklist_updates, "a-");
 	blocklist_updates = g_list_prepend(blocklist_updates, "<uid>");