# HG changeset patch # User Paul Aurich # Date 1247373571 0 # Node ID 95c56191d26c9cb2e97758300cfc0e7a0fff591b # Parent 2a19181b41fa83ff0ae5fc2a9f75a4ee1e50dcc5 For contacts who advertise Entity Caps, check for XHTML-IM support. Refs #4650. For backward-compatibility (and what I, as someone who knows that Jabber supports rich-text, would expect), continue sending it if the contact is offline (i.e. not on the roster). diff -r 2a19181b41fa -r 95c56191d26c ChangeLog --- a/ChangeLog Sun Jul 12 04:35:04 2009 +0000 +++ b/ChangeLog Sun Jul 12 04:39:31 2009 +0000 @@ -96,6 +96,8 @@ kicked. * Fix issues with case-sensitivity of XMPP roster and case-insensitive Purple groups. + * For contacts who advertise Entity Capabilities, only send rich text + markup if they support it. Yahoo!/Yahoo! JAPAN: * P2P file transfers. (Sulabh Mahajan) diff -r 2a19181b41fa -r 95c56191d26c libpurple/protocols/jabber/buddy.c --- a/libpurple/protocols/jabber/buddy.c Sun Jul 12 04:35:04 2009 +0000 +++ b/libpurple/protocols/jabber/buddy.c Sun Jul 12 04:39:31 2009 +0000 @@ -161,7 +161,7 @@ jbr = g_new0(JabberBuddyResource, 1); jbr->jb = jb; jbr->name = g_strdup(resource); - jbr->capabilities = JABBER_CAP_XHTML; + jbr->capabilities = JABBER_CAP_NONE; jbr->tz_off = PURPLE_NO_TZ_OFF; jb->resources = g_list_append(jb->resources, jbr); } @@ -2244,12 +2244,6 @@ } } - /* TODO: Are these messages actually useful? */ - if (node) - purple_debug_info("jabber", "Found cap: %s\n", cap); - else - purple_debug_info("jabber", "Cap %s not found\n", cap); - return (node != NULL); } diff -r 2a19181b41fa -r 95c56191d26c libpurple/protocols/jabber/jabber.h --- a/libpurple/protocols/jabber/jabber.h Sun Jul 12 04:35:04 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.h Sun Jul 12 04:39:31 2009 +0000 @@ -24,7 +24,7 @@ typedef enum { JABBER_CAP_NONE = 0, - JABBER_CAP_XHTML = 1 << 0, +/* JABBER_CAP_XHTML = 1 << 0, */ JABBER_CAP_COMPOSING = 1 << 1, JABBER_CAP_SI = 1 << 2, JABBER_CAP_SI_FILE_XFER = 1 << 3, diff -r 2a19181b41fa -r 95c56191d26c libpurple/protocols/jabber/message.c --- a/libpurple/protocols/jabber/message.c Sun Jul 12 04:35:04 2009 +0000 +++ b/libpurple/protocols/jabber/message.c Sun Jul 12 04:39:31 2009 +0000 @@ -1199,9 +1199,15 @@ xhtml = tmp; } - if ((!jbr || jbr->capabilities & JABBER_CAP_XHTML) && - !jabber_xhtml_plain_equal(xhtml, jm->body)) - jm->xhtml = g_strdup_printf("%s", xhtml); + /* + * For backward compatibility with user expectations or for those not on + * the user's roster, allow sending XHTML-IM markup. + */ + if (!jbr || !jbr->caps.info || + jabber_resource_has_capability(jbr, "http://jabber.org/protocol/xhtml-im")) { + if (!jabber_xhtml_plain_equal(xhtml, jm->body)) + jm->xhtml = g_strdup_printf("%s", xhtml); + } g_free(xhtml);