changeset 24160:89cb9c0f5bd9

merge of '550b0287adae13c3fb57b0b584f2b461370b8464' and '885fba4941a4f260371929c9e4761be5aec9c463'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 02 Oct 2008 04:59:13 +0000
parents a7e1edeb3ac6 (current diff) f54e7398f733 (diff)
children 7ec9a1ae93d7
files
diffstat 3 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Thu Oct 02 04:59:11 2008 +0000
+++ b/libpurple/protocols/msn/contact.c	Thu Oct 02 04:59:13 2008 +0000
@@ -1111,20 +1111,24 @@
 
 /*delete a Contact*/
 void
-msn_delete_contact(MsnSession *session, const char *contactId)
+msn_delete_contact(MsnSession *session, MsnUser *user)
 {
 	gchar *body = NULL;
 	gchar *contact_id_xml = NULL ;
 	MsnCallbackState *state;
 
-	g_return_if_fail(contactId != NULL);
-	contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, contactId);
+	if (user->uid != NULL) {
+		contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid);
+		purple_debug_info("msn", "Deleting contact with contactId: %s\n", user->uid);
+	} else {
+		contact_id_xml = g_strdup_printf(MSN_CONTACT_XML, user->passport);
+		purple_debug_info("msn", "Deleting contact with passport: %s\n", user->passport);
+	}
 
 	state = msn_callback_state_new(session);
-	msn_callback_state_set_uid(state, contactId);
+	msn_callback_state_set_uid(state, user->uid);
 
 	/* build SOAP request */
-	purple_debug_info("msn", "Deleting contact with contactId: %s\n", contactId);
 	body = g_strdup_printf(MSN_DEL_CONTACT_TEMPLATE, contact_id_xml);
 
 	state->body = xmlnode_from_str(body, -1);
@@ -1191,7 +1195,10 @@
 	msn_callback_state_set_guid(state, groupId);
 	msn_callback_state_set_old_group_name(state, group_name);
 
-	contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid);
+	if (user->uid != NULL)
+		contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid);
+	else
+		contact_id_xml = g_strdup_printf(MSN_CONTACT_XML, passport);
 	body = g_strdup_printf(MSN_CONTACT_DEL_GROUP_TEMPLATE, contact_id_xml, groupId);
 
 	state->body = xmlnode_from_str(body, -1);
--- a/libpurple/protocols/msn/contact.h	Thu Oct 02 04:59:11 2008 +0000
+++ b/libpurple/protocols/msn/contact.h	Thu Oct 02 04:59:13 2008 +0000
@@ -654,7 +654,7 @@
 
 void msn_add_contact(MsnSession *session, MsnCallbackState *state,
 		     const char *passport);
-void msn_delete_contact(MsnSession *session, const char *contactId);
+void msn_delete_contact(MsnSession *session, MsnUser *user);
 
 void msn_add_contact_to_group(MsnSession *session, MsnCallbackState *state,
 			      const char *passport, const char *groupId);
--- a/libpurple/protocols/msn/userlist.c	Thu Oct 02 04:59:11 2008 +0000
+++ b/libpurple/protocols/msn/userlist.c	Thu Oct 02 04:59:13 2008 +0000
@@ -652,7 +652,7 @@
 				NULL, ab,
 				G_CALLBACK(userlist_ab_delete_cb), G_CALLBACK(userlist_ab_delete_cb));
 		} else
-			msn_delete_contact(userlist->session, user->uid);
+			msn_delete_contact(userlist->session, user);
 	}
 }