diff libpurple/protocols/msn/contact.c @ 27488:3698c7f4d803

On MSN, pop up an "invite message" request similar to oscar, and send that in the add request. We really should try and move this into the add buddy dialog instead of an extra prompt. Fixes #8503.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 13 Jul 2009 05:01:42 +0000
parents 01f1929d0936
children 975fc5f64438
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Sun Jul 12 22:40:54 2009 +0000
+++ b/libpurple/protocols/msn/contact.c	Mon Jul 13 05:01:42 2009 +0000
@@ -1159,7 +1159,7 @@
 {
 	MsnUserList *userlist;
 	MsnUser *user;
-	gchar *body = NULL, *contact_xml;
+	gchar *body = NULL, *contact_xml, *invite;
 
 	g_return_if_fail(passport != NULL);
 	g_return_if_fail(groupId != NULL);
@@ -1207,7 +1207,23 @@
 		contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport);
 	}
 
-	body = g_strdup_printf(MSN_ADD_CONTACT_GROUP_TEMPLATE, groupId, contact_xml);
+	if (user->invite_message) {
+		char *tmp;
+		body = g_markup_escape_text(user->invite_message, -1);
+		tmp = g_markup_escape_text(purple_connection_get_display_name(session->account->gc), -1);
+		invite = g_strdup_printf(MSN_CONTACT_INVITE_MESSAGE_XML, body, tmp);
+		g_free(body);
+		g_free(tmp);
+
+		/* We can free this now */
+		g_free(user->invite_message);
+		user->invite_message = NULL;
+
+	} else {
+		invite = g_strdup("");
+	}
+
+	body = g_strdup_printf(MSN_ADD_CONTACT_GROUP_TEMPLATE, groupId, contact_xml, invite);
 
 	state->body = xmlnode_from_str(body, -1);
 	state->post_action = MSN_ADD_CONTACT_GROUP_SOAP_ACTION;
@@ -1215,6 +1231,7 @@
 	state->cb = msn_add_contact_to_group_read_cb;
 	msn_contact_request(state);
 
+	g_free(invite);
 	g_free(contact_xml);
 	g_free(body);
 }