changeset 23735:35f7b7c62995

Remove calls to g_markup_escape_text. Not only does this help with old GLib compatibility, but some of these calls were wrong, too. It just never showed up because the code doesn't run yet.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 15 Aug 2008 04:27:42 +0000
parents d572fb194e61
children 74e527fbb5e4
files libpurple/protocols/msn/contact.c libpurple/protocols/msn/msn.c libpurple/protocols/msn/page.c
diffstat 3 files changed, 33 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Fri Aug 15 04:13:40 2008 +0000
+++ b/libpurple/protocols/msn/contact.c	Fri Aug 15 04:27:42 2008 +0000
@@ -214,6 +214,7 @@
 msn_create_address_book(MsnSession *session)
 {
 	gchar *body;
+	gchar *token_str;
 
 	g_return_if_fail(session != NULL);
 	g_return_if_fail(session->user != NULL);
@@ -221,9 +222,11 @@
 	
 	purple_debug_info("msn", "Creating an Address Book.\n");
 
-	body = g_markup_printf_escaped(MSN_ADD_ADDRESSBOOK_TEMPLATE,
-		msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
-		session->user->passport);
+	token_str = g_markup_escape_text(
+		msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS), -1);
+	body = g_strdup_printf(MSN_ADD_ADDRESSBOOK_TEMPLATE,
+		token_str, session->user->passport);
+	g_free(token_str);
 
 	msn_soap_message_send(session,
 		msn_soap_message_new(MSN_ADD_ADDRESSBOOK_SOAP_ACTION,
@@ -398,6 +401,7 @@
 {
 	gchar *body = NULL;
 	gchar *update_str = NULL;
+	gchar *token_str;
 	GetContactListCbData cb_data = { session, partner_scenario };
 	const gchar *partner_scenario_str = MsnSoapPartnerScenarioText[partner_scenario];
 
@@ -405,12 +409,14 @@
 
 	if (update_time != NULL) {
 		purple_debug_info("msn", "CL Last update time: %s\n", update_time);
-		update_str = g_strdup_printf(MSN_GET_CONTACT_UPDATE_XML,update_time);
+		update_str = g_strdup_printf(MSN_GET_CONTACT_UPDATE_XML, update_time);
 	}
 
-	body = g_markup_printf_escaped(MSN_GET_CONTACT_TEMPLATE, partner_scenario_str,
-		msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
-		update_str ? update_str : "");
+	token_str = g_markup_escape_text(
+		msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS), -1);
+	body = g_strdup_printf(MSN_GET_CONTACT_TEMPLATE, partner_scenario_str,
+		token_str, update_str ? update_str : "");
+	g_free(token_str);
 
 	msn_soap_message_send(session,
 		msn_soap_message_new(MSN_GET_CONTACT_SOAP_ACTION,
@@ -798,6 +804,7 @@
 	const char *dynamicItemLastChange)
 {
 	char *body, *update_str = NULL;
+	gchar *token_str;
 
 	purple_debug_misc("msn", "Getting Address Book\n");
 
@@ -807,10 +814,13 @@
 	else if (LastChanged != NULL)
 		update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, LastChanged);
 
-	body = g_markup_printf_escaped(MSN_GET_ADDRESS_TEMPLATE,
+	token_str = g_markup_escape_text(
+		msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS), -1);
+	body = g_strdup_printf(MSN_GET_ADDRESS_TEMPLATE,
 		MsnSoapPartnerScenarioText[partner_scenario],
-		msn_nexus_get_token_str(session->nexus, MSN_AUTH_CONTACTS),
+		token_str,
 		update_str ? update_str : "");
+	g_free(token_str);
 
 	msn_soap_message_send(session,
 		msn_soap_message_new(MSN_GET_ADDRESS_SOAP_ACTION,
--- a/libpurple/protocols/msn/msn.c	Fri Aug 15 04:13:40 2008 +0000
+++ b/libpurple/protocols/msn/msn.c	Fri Aug 15 04:27:42 2008 +0000
@@ -713,10 +713,16 @@
 		if (name != NULL && *name) {
 			char *tmp2;
 
+			tmp2 = g_markup_escape_text(name, -1);
 			if (purple_presence_is_idle(presence)) {
-				tmp2 = g_markup_printf_escaped("%s/%s", name, _("Idle"));
-			} else {
-				tmp2 = g_markup_escape_text(name, -1);
+				char *idle;
+				char *tmp3;
+				/* Never know what those translations might end up like... */
+				idle = g_markup_escape_text(_("Idle"), -1);
+				tmp3 = g_strdup_printf("%s/%s", tmp2, idle);
+				g_free(idle);
+				g_free(tmp2);
+				tmp2 = tmp3;
 			}
 
 			if (psm != NULL && *psm) {
--- a/libpurple/protocols/msn/page.c	Fri Aug 15 04:13:40 2008 +0000
+++ b/libpurple/protocols/msn/page.c	Fri Aug 15 04:27:42 2008 +0000
@@ -50,12 +50,15 @@
 msn_page_gen_payload(const MsnPage *page, size_t *ret_size)
 {
 	char *str;
+	char *body;
 
 	g_return_val_if_fail(page != NULL, NULL);
 
-	str = g_markup_printf_escaped(
+	body = g_markup_escape_text(msn_page_get_body(page), -1);
+	str = g_strdup_printf(
 			"<TEXT xml:space=\"preserve\" enc=\"utf-8\">%s</TEXT>",
-			msn_page_get_body(page));
+			body);
+	g_free(body);
 
 	if (ret_size != NULL)
 		*ret_size = strlen(str);