Mercurial > pidgin.yaz
comparison 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 |
comparison
equal
deleted
inserted
replaced
29294:47f2c7291013 | 29296:5bacbd78e2b4 |
---|---|
1191 } | 1191 } |
1192 | 1192 |
1193 tmp = purple_utf8_strip_unprintables(msg); | 1193 tmp = purple_utf8_strip_unprintables(msg); |
1194 purple_markup_html_to_xhtml(tmp, &xhtml, &jm->body); | 1194 purple_markup_html_to_xhtml(tmp, &xhtml, &jm->body); |
1195 g_free(tmp); | 1195 g_free(tmp); |
1196 | |
1196 tmp = jabber_message_smileyfy_xhtml(jm, xhtml); | 1197 tmp = jabber_message_smileyfy_xhtml(jm, xhtml); |
1197 if (tmp) { | 1198 if (tmp) { |
1198 g_free(xhtml); | 1199 g_free(xhtml); |
1199 xhtml = tmp; | 1200 xhtml = tmp; |
1200 } | 1201 } |
1204 * the user's roster, allow sending XHTML-IM markup. | 1205 * the user's roster, allow sending XHTML-IM markup. |
1205 */ | 1206 */ |
1206 if (!jbr || !jbr->caps.info || | 1207 if (!jbr || !jbr->caps.info || |
1207 jabber_resource_has_capability(jbr, NS_XHTML_IM)) { | 1208 jabber_resource_has_capability(jbr, NS_XHTML_IM)) { |
1208 if (!jabber_xhtml_plain_equal(xhtml, jm->body)) | 1209 if (!jabber_xhtml_plain_equal(xhtml, jm->body)) |
1209 jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'>%s</body></html>", xhtml); | 1210 /* Wrap the message in <p/> for great interoperability justice. */ |
1211 jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'><p>%s</p></body></html>", xhtml); | |
1210 } | 1212 } |
1211 | 1213 |
1212 g_free(xhtml); | 1214 g_free(xhtml); |
1213 | 1215 |
1214 jabber_message_send(jm); | 1216 jabber_message_send(jm); |
1247 g_free(xhtml); | 1249 g_free(xhtml); |
1248 xhtml = tmp; | 1250 xhtml = tmp; |
1249 } | 1251 } |
1250 | 1252 |
1251 if (chat->xhtml && !jabber_xhtml_plain_equal(xhtml, jm->body)) | 1253 if (chat->xhtml && !jabber_xhtml_plain_equal(xhtml, jm->body)) |
1252 jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'>%s</body></html>", xhtml); | 1254 /* Wrap the message in <p/> for greater interoperability justice. */ |
1255 jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'><p>%s</p></body></html>", xhtml); | |
1253 | 1256 |
1254 g_free(xhtml); | 1257 g_free(xhtml); |
1255 | 1258 |
1256 jabber_message_send(jm); | 1259 jabber_message_send(jm); |
1257 jabber_message_free(jm); | 1260 jabber_message_free(jm); |