diff libpurple/protocols/jabber/message.c @ 29296: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 5b449584fead
children 31d9677b0c36 8271e42acdcb
line wrap: on
line diff
--- 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);