merge of '844a19c4148778a7ffb0770a9264621456d807cc'

Mon, 03 Sep 2007 05:17:32 +0000

author
Jeff Connelly <jeff2@soc.pidgin.im>
date
Mon, 03 Sep 2007 05:17:32 +0000
changeset 19736
ff4842155dd2
parent 19731
844a19c41487 (diff)
parent 19735
deb4971dc234 (current diff)
child 19737
6e363a9b0699
child 19762
de705524c134

merge of '844a19c4148778a7ffb0770a9264621456d807cc'
and 'deb4971dc2340ab985d4de7003d1d4609c595e2c'

--- a/libpurple/protocols/myspace/markup.c	Sun Sep 02 08:00:54 2007 +0000
+++ b/libpurple/protocols/myspace/markup.c	Mon Sep 03 05:17:32 2007 +0000
@@ -669,6 +669,8 @@
 
 /** High-level function to convert Purple (HTML) to MySpaceIM markup.
  *
+ * TODO: consider using purple_markup_html_to_xhtml() to make valid XML.
+ *
  * @return HTML markup string, must be g_free()'d. */
 gchar *
 html_to_msim_markup(MsimSession *session, const gchar *raw)
--- a/libpurple/protocols/myspace/myspace.c	Sun Sep 02 08:00:54 2007 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Mon Sep 03 05:17:32 2007 +0000
@@ -1066,9 +1066,12 @@
 	statstring = purple_status_get_attr_string(status, "message");
 
 	if (!statstring) {
-		statstring = g_strdup("");
+		statstring = "";
 	}
 
+	/* Status strings are plain text. */
+	statstring = purple_markup_strip_html(statstring);
+
 	msim_set_status_code(session, status_code, g_strdup(statstring));
 }
 
@@ -1713,7 +1716,7 @@
 	PurpleBuddyList *blist;
 	MsimUser *user;
 	GList *list;
-	gchar *status_headline;
+	gchar *status_headline, *status_headline_escaped;
 	gint status_code, purple_status_code;
 	gchar *username;
 
@@ -1768,8 +1771,16 @@
 		purple_debug_info("msim", "msim_status: found buddy %s\n", username);
 	}
 
+	/* The status headline is plaintext, but libpurple treats it as HTML,
+	 * so escape any HTML characters to their entity equivalents. */
+	status_headline_escaped = g_markup_escape_text(status_headline, strlen(status_headline));
+	g_free(status_headline);
+
+	if (user->headline) 
+		g_free(user->headline);
+
 	/* don't copy; let the MsimUser own the headline, memory-wise */
-	user->headline = status_headline;
+	user->headline = status_headline_escaped;
   
 	/* Set user status */
 	switch (status_code) {

mercurial