pidgin: bf125a8a: Fix a corner case where purple_markup_ht...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Jan 24 00:21:10 EST 2010


-----------------------------------------------------------------
Revision: bf125a8aa68d8d5a177f58d12004895decf4c050
Ancestor: 779eca7c0854d4a8f2108ed8274ab5b588490884
Author: darkrain42 at pidgin.im
Date: 2010-01-24T05:15:33
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/bf125a8aa68d8d5a177f58d12004895decf4c050

Modified files:
        libpurple/tests/test_util.c libpurple/util.c

ChangeLog: 

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>

-------------- next part --------------
============================================================
--- libpurple/tests/test_util.c	82dde90a04c833705fa85b4570a6d870f57eeaa3
+++ libpurple/tests/test_util.c	97bd0ced6da1a62f501c5640a12649056e037bbb
@@ -113,6 +113,11 @@ START_TEST(test_markup_html_to_xhtml)
 	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
 
============================================================
--- libpurple/util.c	18926393631e24f44ff0a661537c8e5ad031ba58
+++ libpurple/util.c	d1771bfbcbd754eb92de800a43f7a102cc85ec99
@@ -1519,7 +1519,7 @@ purple_markup_html_to_xhtml(const char *
 				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 */


More information about the Commits mailing list