changeset 28909:5bacbd78e2b4

jabber: Wrap XHTML-IM messages in <p/> for greater interoperability justice. Closes #11253 This is pretty simplistic, and doesn't check if the message already has a <p/>, because fully checking that would require a lot more effort.
author Paul Aurich <paul@darkrain42.org>
date Tue, 26 Jan 2010 02:18:16 +0000
parents 47f2c7291013
children 708e89126ba1
files ChangeLog libpurple/protocols/jabber/message.c
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jan 24 22:49:33 2010 +0000
+++ b/ChangeLog	Tue Jan 26 02:18:16 2010 +0000
@@ -3,6 +3,8 @@
 version 2.6.6 (??/??/20??):
 	libpurple:
 	* Fix 'make check' on OS X. (David Fang)
+	* Fix a quirk in purple_markup_html_to_xhtml that caused some messages
+	  to be improperly converted to XHTML.
 
 	General:
 	* Correctly disable all missing dependencies when using the
@@ -27,6 +29,8 @@
 	* When getting info on a domain-only (server) JID, show uptime
 	  (when given by the result of the "last query") and don't show status as
 	  offline.
+	* Wrap XHTML messages in <p>, as described in XEP-0071, for compatibility
+	  with some clients.
 
 	Pidgin:
 	* Correctly size conversation and status box entries when the
--- a/libpurple/protocols/jabber/message.c	Sun Jan 24 22:49:33 2010 +0000
+++ b/libpurple/protocols/jabber/message.c	Tue Jan 26 02:18:16 2010 +0000
@@ -1193,6 +1193,7 @@
 	tmp = purple_utf8_strip_unprintables(msg);
 	purple_markup_html_to_xhtml(tmp, &xhtml, &jm->body);
 	g_free(tmp);
+
 	tmp = jabber_message_smileyfy_xhtml(jm, xhtml);
 	if (tmp) {
 		g_free(xhtml);
@@ -1206,7 +1207,8 @@
 	if (!jbr || !jbr->caps.info ||
 			jabber_resource_has_capability(jbr, NS_XHTML_IM)) {
 		if (!jabber_xhtml_plain_equal(xhtml, jm->body))
-			jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'>%s</body></html>", xhtml);
+			/* Wrap the message in <p/> for great interoperability justice. */
+			jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'><p>%s</p></body></html>", xhtml);
 	}
 
 	g_free(xhtml);
@@ -1249,7 +1251,8 @@
 	}
 
 	if (chat->xhtml && !jabber_xhtml_plain_equal(xhtml, jm->body))
-		jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'>%s</body></html>", xhtml);
+		/* Wrap the message in <p/> for greater interoperability justice. */
+		jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'><p>%s</p></body></html>", xhtml);
 
 	g_free(xhtml);