Changeset 3a620ff for protocols


Ignore:
Timestamp:
2015-12-16T01:02:12Z (8 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
d11ccbf
Parents:
4c29622
Message:

jabber: Add message processing hints to OTR messages (XEP-0334/0364)

This prevents them from being stored or copied to other clients when
carbons are enabled.

Location:
protocols/jabber
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    r4c29622 r3a620ff  
    432432                /* Just make sure we do this only once. */
    433433                bud->flags |= JBFLAG_PROBED_XEP85;
     434        }
     435
     436        /* XEP-0364 suggests we add message processing hints (XEP-0334) to OTR messages,
     437           mostly to avoid carbons (XEP-0280) and server-side message archiving.
     438           OTR messages are roughly like this: /^\?OTR(.*\?| Error:|:)/
     439           But I'm going to simplify it to messages starting with "?OTR". */
     440        if (g_str_has_prefix(message, "?OTR")) {
     441                int i;
     442                char *hints[] = {
     443                        "no-copy", XMLNS_HINTS,
     444                        "no-permanent-store", XMLNS_HINTS,
     445                        "private", XMLNS_CARBONS,
     446                        NULL
     447                };
     448                       
     449                for (i = 0; hints[i]; i += 2) {
     450                        struct xt_node *hint;
     451                        hint = xt_new_node(hints[i], NULL, NULL);
     452                        xt_add_attr(hint, "xmlns", hints[i + 1]);
     453                        xt_add_child(node, hint);
     454                }
    434455        }
    435456
  • protocols/jabber/jabber.h

    r4c29622 r3a620ff  
    230230#define XMLNS_CARBONS      "urn:xmpp:carbons:2"                                  /* XEP-0280 */
    231231#define XMLNS_FORWARDING   "urn:xmpp:forward:0"                                  /* XEP-0297 */
     232#define XMLNS_HINTS        "urn:xmpp:hints"                                      /* XEP-0334 */
    232233#define XMLNS_CHATSTATES   "http://jabber.org/protocol/chatstates"               /* XEP-0085 */
    233234#define XMLNS_DISCO_INFO   "http://jabber.org/protocol/disco#info"               /* XEP-0030 */
Note: See TracChangeset for help on using the changeset viewer.