changeset 24222:7ec9a1ae93d7

Save the MSN ContactID after adding a buddy so it can be used for subsequent operations. This should fix moving the buddy between groups or deleting the buddy during the same session the buddy was added. Fixes #7274.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 02 Oct 2008 05:37:38 +0000
parents 89cb9c0f5bd9
children 3612a4fbd88c e473291375b4
files libpurple/protocols/msn/contact.c
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Thu Oct 02 04:59:13 2008 +0000
+++ b/libpurple/protocols/msn/contact.c	Thu Oct 02 05:37:38 2008 +0000
@@ -941,6 +941,7 @@
 
 	MsnUserList *userlist;
 	MsnUser *user;
+	xmlnode *guid;
 
 	g_return_if_fail(session != NULL);
 
@@ -960,6 +961,15 @@
 
 	user = msn_userlist_find_add_user(userlist, state->who, state->who);
 	msn_user_add_group_id(user, state->guid);
+
+	guid = xmlnode_get_child(resp->xml,
+		"Body/ABContactAddResponse/ABContactAddResult/guid");
+	if (guid != NULL) {
+		char *uid = xmlnode_get_data(guid);
+		msn_user_set_uid(user, uid);
+		purple_debug_info("msn", "Set %s guid to %s.\n", state->who, uid);
+		g_free(uid);
+	}
 }
 
 /* add a Contact in MSN_INDIVIDUALS_GROUP */
@@ -1016,6 +1026,15 @@
 
 	if (state->action & MSN_ADD_BUDDY) {
 		MsnUser *user = msn_userlist_find_user(userlist, state->who);
+		xmlnode *guid = xmlnode_get_child(resp->xml,
+			"Body/ABGroupContactAddResponse/ABGroupContactAddResult/guid");
+
+		if (guid != NULL) {
+			char *uid = xmlnode_get_data(guid);
+			msn_user_set_uid(user, uid);
+			purple_debug_info("msn", "Set %s guid to %s.\n", state->who, uid);
+			g_free(uid);
+		}
 
 		if ( !msn_user_is_yahoo(state->session->account, state->who) ) {
 			msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL);