%ents; ]>
Message Fastening This specification defines a way for payloads on a message to be marked as being logically fastened to a previous message. &LEGALNOTICE; 0422 Deferred Standards Track Standards Council XMPP Core XEP-0001 XEP-0030 XEP-0115 XEP-0359 fasten Kevin Smith kevin.smith@isode.com &dcridland; 0.2.0 2019-12-30 ks/dwd Preparation for extending MAM 0.1.2 2019-12-16 ps Typographical fixes 0.1.1 2019-09-11 lnj Typographical fixes 0.1.0 2019-09-11 XEP Editor (jsc) Accepted by vote of Council on 2019-09-11. 0.0.1 2019-09-04 ks

First draft.

There are many situations in which a message contains a payload that adds additional information to the context of a previous message. Examples of this might be a user sending a reaction (e.g. a thumbs-up emoji) to another user's message, or a server adding information on a link previously posted to a chat room, a user updating/editing the content of a message they've previously sent. This specification provides a generic wrapper to fasten such new payloads to the message to which they apply.

If a client implements message fastening (that is, it is capable of understanding the payload when received), it MUST specify the 'urn:xmpp:fasten:0' feature in its service discovery information features as specified in &xep0030; and the Entity Capabilities profile specified in &xep0115;.

]]> ... ... ]]>

In order to mark that a payload applies to a previous message, a message is sent containing an "apply-to" element in the namespace "urn:xmpp:fasten:0", with attribute "id" that contains the &xep0359; origin-id of the stanza to which it applies, the children of which element are those that apply to the previous message (these are "wrapped payloads" because they are wrapped inside the <apply-to> element). The id of this apply-to-containing message is unimportant, and the type SHOULD be "normal" (KS: I don't care about this, it just seemed easier to spell it out).

If "user2@chatservice.example" wanted to send their approval (using a fictional 'i-like-this' element) for a message previously sent to chat room "chatroom@chatservice.example" with origin-id "origin-id-1", they would do the following.

An <apply-to> may contain several fastenings, but they must all be of the same type (the same qualified name)

]]>

Where the payload being fastened needs top-level child elements of the stanza holding the fastening (e.g. if a message edit uses the top-level <body> child), these can be listed in <external> child elements of the <apply-to> element, in the same namespace. An <external> element has two attributes: the 'name' attribute MUST be included, and is the name of the top-level stanza child element; the 'element-namespace' attribute specifies the namespace of the element, or if absent indicates that the element is in the same namespace as the stanza (eliding the stream namespace in this way avoids issues when transporting fastenings across combinations of 'jabber:server' and 'jabber:client' streams.

If "user2@chatservice.example" wanted to send an edit (using a fictional protocol) of a message they previously sent with origin-id 'origin-id-2', and the edit protocol used top-level <body> and <custom> elements, it would look like this.

Hi there New data ]]>

Note that the first child of the <apply-to> should be the fastening type, and the <external> should follow. If a receiving entity finds unknown namespaced elements inside an <apply-to> with qualified name different to the fastening type, they should be ignored (this allows us to introduce new fastening children in the future, similar to <external>, and maintain backwards compatibility).

A fastening of a given type (qualified name) can be replaced by sending a new fastening of the same qualified name - as with the original fastening there may be several fastenings of this type (qualified name), but all fastenings must be of the same type. The child payloads of the <apply-to> element then logically replace all fastenings previously applied by the sending entity with the same qualified name (name and namespace).

For example, if user2 wished to update the fastening from the first example they would send:

Very much ]]>

Fastenings of a given type (qualified name) can be removed by sending a new (empty) fastening of the same qualified name only (no other attributes and no children) and setting an attribute 'clear' with value 'true' on the <apply-to;> element. This logically replaces all the previous fastenings from this sender of this qualified name with an empty list of fastenings.

For example, if user2 wished to remove the fastenings from the first example they would send:

]]>

Where the contents of a fastening are sensitive and must be encrypted (e.g. if a message editing spec. uses fastening, the contents of the edit are sensitive), it is suggested that the plaintext contains an <apply-to> with no content other than the id and an attribute of "shell" whose value is "true", to indicate that the apply-to is a shell with no content. This allows a server to still collate the fastened stanzas, while not allowing it to read the content. The encrypted content MUST then include the full <apply-to> element, which a client MUST use post-decryption and ignore the shell element.

]]>

In order for a message to be able to have fastenings applied to it it must contain a &xep0359; stanza id.

A message must only contain a single "apply-to" element (i.e. a message cannot be fastened to multiple other messages).

Fastenings are not to be chained - an <apply-to> element MUST reply to the original message to which it applies, not to an earlier fastening-containing-message (the 'id' attribute of an <apply-to> element must not be that of a stanza that itself contains an <apply-to>). For example, if this spec is used in the future to wrap multiple subsquent message edits for the same source message, each <apply-to> would contain the original stanza's id, not the id of any subsequent fastening stanza.

Some payloads should not be allowed to be fastened to a particular message by all users - e.g. if used to wrap message edits, it would be expected that only the original author be allowed to edit their message. It's the responsibility of specifications for protocols to be fastened to destribe such "who is allowed to do this?" applicability rules.

Multiple fastenings of the same type may be present in a single attach-to element, but fastening types may not be mixed in this way.

TODO: (future XEP) special handling by the archive to allow grouping and querying of things fastened to a message (this is going to involve following the externals and potentially wrapping them inside the apply-to when fetching from the archive).

This document requires no interaction with &IANA;.

The ®ISTRAR; includes 'urn:xmpp:fasten:0' in its registry of protocol namespaces (see &NAMESPACES;).

  • urn:xmpp:fasten:0

The authors would like to thank Marvin Wissfeld, Florian Schmaus, Philipp Hörist, Jonas Schäfer, Ralph Meijer and others who've replied on-list for their feedback.