changeset 29293:68bc7c617fa0

Fix a corner case where purple_markup_html_to_xhtml generated malformed XHTML. <FONT>blah</FONT> would turn into x</span>. This is pretty bad, since that's what Adium passes to libpurple when the text had no markup, and is what causes XMPP messages sent in Adium to look like: <body>.</body><body xmlns='http://www.w3.org/1999/xhtml'>.</body>
author Paul Aurich <paul@darkrain42.org>
date Sun, 24 Jan 2010 05:15:33 +0000
parents d69df70937cc
children 47f2c7291013
files libpurple/tests/test_util.c libpurple/util.c
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/tests/test_util.c	Sun Jan 24 03:53:36 2010 +0000
+++ b/libpurple/tests/test_util.c	Sun Jan 24 05:15:33 2010 +0000
@@ -113,6 +113,11 @@
 	purple_markup_html_to_xhtml("<a>", &xhtml, &plaintext);
 	assert_string_equal_free("<a href=\"\"></a>", xhtml);
 	assert_string_equal_free("", plaintext);
+
+
+	purple_markup_html_to_xhtml("<FONT>x</FONT>", &xhtml, &plaintext);
+	assert_string_equal_free("x", xhtml);
+	assert_string_equal_free("x", plaintext);
 }
 END_TEST
 
--- a/libpurple/util.c	Sun Jan 24 03:53:36 2010 +0000
+++ b/libpurple/util.c	Sun Jan 24 05:15:33 2010 +0000
@@ -1519,7 +1519,7 @@
 				if(tag) {
 					while(tags) {
 						struct purple_parse_tag *pt = tags->data;
-						if(xhtml)
+						if(xhtml && !pt->ignore)
 							g_string_append_printf(xhtml, "</%s>", pt->dest_tag);
 						if(plain && purple_strequal(pt->src_tag, "a")) {
 							/* if this is a link, we have to add the url to the plaintext, too */