diff libpurple/protocols/msn/contact.c @ 24206:f54e7398f733

Use the MSN passport in more places instead of the Contact ID if it's not available. References #7274.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 02 Oct 2008 04:52:38 +0000
parents 35f7b7c62995
children 7ec9a1ae93d7
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Tue Sep 30 00:49:53 2008 +0000
+++ b/libpurple/protocols/msn/contact.c	Thu Oct 02 04:52:38 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);