changeset 24748:75ecd41a64ba

Fix a bug where if "Show our presence only to people on our buddy list" is true and we remove someone from our buddy list then re-add them they would not see our presence until the next time we logged out and back on.
author Mark Doliner <mark@kingant.net>
date Wed, 17 Dec 2008 00:06:05 +0000
parents 722732726d91
children 6b7cd5769e98 a4a17fe80160
files libpurple/protocols/myspace/myspace.c
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Tue Dec 16 23:43:25 2008 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Wed Dec 17 00:06:05 2008 +0000
@@ -2549,6 +2549,7 @@
 	MsimMessage *msg;
 	MsimMessage *msg_persist;
 	MsimMessage *body;
+	GList *blocklist_updates;
 
 	session = (MsimSession *)gc->proto_data;
 	purple_debug_info("msim", "msim_add_buddy: want to add %s to %s\n",
@@ -2601,6 +2602,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);
 }
 
 /**
@@ -2649,6 +2671,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>");