diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/jabber/jabber.c | 21 | ||||
-rw-r--r-- | protocols/jabber/jabber.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 0da65c84..6e7b89af 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -433,6 +433,27 @@ static int jabber_buddy_msg(struct im_connection *ic, char *who, char *message, bud->flags |= JBFLAG_PROBED_XEP85; } + /* XEP-0364 suggests we add message processing hints (XEP-0334) to OTR messages, + mostly to avoid carbons (XEP-0280) and server-side message archiving. + OTR messages are roughly like this: /^\?OTR(.*\?| Error:|:)/ + But I'm going to simplify it to messages starting with "?OTR". */ + if (g_str_has_prefix(message, "?OTR")) { + int i; + char *hints[] = { + "no-copy", XMLNS_HINTS, + "no-permanent-store", XMLNS_HINTS, + "private", XMLNS_CARBONS, + NULL + }; + + for (i = 0; hints[i]; i += 2) { + struct xt_node *hint; + hint = xt_new_node(hints[i], NULL, NULL); + xt_add_attr(hint, "xmlns", hints[i + 1]); + xt_add_child(node, hint); + } + } + st = jabber_write_packet(ic, node); xt_free_node(node); diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index 8796b8fc..a52280af 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -229,6 +229,7 @@ struct jabber_transfer { #define XMLNS_GMAILNOTIFY "google:mail:notify" /* Not a XEP */ #define XMLNS_CARBONS "urn:xmpp:carbons:2" /* XEP-0280 */ #define XMLNS_FORWARDING "urn:xmpp:forward:0" /* XEP-0297 */ +#define XMLNS_HINTS "urn:xmpp:hints" /* XEP-0334 */ #define XMLNS_CHATSTATES "http://jabber.org/protocol/chatstates" /* XEP-0085 */ #define XMLNS_DISCO_INFO "http://jabber.org/protocol/disco#info" /* XEP-0030 */ #define XMLNS_DISCO_ITEMS "http://jabber.org/protocol/disco#items" /* XEP-0030 */ |