1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-27 11:42:17 -05:00
xeps/xep-0422.xml

182 lines
12 KiB
XML
Raw Normal View History

2019-09-11 11:24:28 -04:00
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Message Fastening</title>
<abstract>This specification defines a way for payloads on a message to be marked as being logically fastened to a previous message.</abstract>
&LEGALNOTICE;
<number>0422</number>
<status>Deferred</status>
2019-09-11 11:24:28 -04:00
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
<spec>XEP-0001</spec>
<spec>XEP-0030</spec>
<spec>XEP-0115</spec>
<spec>XEP-0359</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>fasten</shortname>
<author>
<firstname>Kevin</firstname>
<surname>Smith</surname>
<email>kevin.smith@isode.com</email>
</author>
2019-12-18 11:42:08 -05:00
&dcridland;
<revision>
<version>0.2.0</version>
<date>2019-12-30</date>
2019-12-18 11:42:08 -05:00
<initials>ks/dwd</initials>
<remark>Preparation for extending MAM</remark>
</revision>
<revision>
<version>0.1.2</version>
<date>2019-12-16</date>
<initials>ps</initials>
<remark>Typographical fixes</remark>
</revision>
2019-09-11 11:57:48 -04:00
<revision>
<version>0.1.1</version>
<date>2019-09-11</date>
<initials>lnj</initials>
<remark>Typographical fixes</remark>
</revision>
2019-09-11 11:24:28 -04:00
<revision>
<version>0.1.0</version>
<date>2019-09-11</date>
<initials>XEP Editor (jsc)</initials>
<remark>Accepted by vote of Council on 2019-09-11.</remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2019-09-04</date>
<initials>ks</initials>
<remark><p>First draft.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>
2019-12-18 11:42:08 -05:00
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.
2019-09-11 11:24:28 -04:00
</p>
</section1>
<section1 topic='Discovering support' anchor='disco'>
<p>
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;.
</p>
<example caption='Client requests information about a chat partner&apos;s client'><![CDATA[
<iq type='get'
to='romeo@montague.lit/orchard'
from='juliet@capulet.lit/balcony'
id='info1'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>]]></example>
<example caption='Partner&apos;s client advertises support for message fastening'><![CDATA[
2019-09-11 11:24:28 -04:00
<iq type='result'
to='juliet@capulet.lit/balcony'
from='romeo@montague.lit/orchard'
id='info1'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
<feature var='urn:xmpp:fasten:0'/>
...
</query>
</iq>]]></example>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
<section2 topic="Wrapped Payloads" anchor="wrapped-payloads">
<p>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 &lt;apply-to&gt; 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).</p>
<p>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.</p>
2019-12-18 11:42:08 -05:00
<p>An &lt;apply-to&gt; may contain several fastenings, but they must all be of the same type (the same qualified name)</p>
2019-09-11 11:24:28 -04:00
<example caption="User2 sends fictional approval"><![CDATA[
<message id="2" from="user2@chatservice.example" to "chatroom@chatservice.example">
<apply-to xmlns="urn:xmpp:fasten:0" id="origin-id-1">
2019-12-18 11:42:08 -05:00
<i-like-this xmlns='urn:example:like'/>
2019-09-11 11:24:28 -04:00
</apply-to>
</message>
]]></example>
</section2>
<section2 topic="External Payloads" anchor="external-payloads">
<p>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 &lt;body&gt; child), these can be listed in &lt;external&gt; child elements of the &lt;apply-to&gt; element, in the same namespace. An &lt;external&gt; 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.</p>
<p>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 &lt;body&gt; and &lt;custom&gt; elements, it would look like this.</p>
<example caption="User2 applies"><![CDATA[
2019-09-11 11:57:27 -04:00
<message id="4" from="user2@chatservice.example" to="chatroom@chatservice.example">
2019-09-11 11:24:28 -04:00
<apply-to xmlns="urn:xmpp:fasten:0" id="origin-id-2">
<edit xmlns='urn:example.edit'/>
2019-12-18 11:42:08 -05:00
<external name='body'/>
2019-09-11 11:24:28 -04:00
</apply-to>
<body>Hi there</body>
<custom xmlns='urn:example:custom'>New data</custom>
</message>
]]></example>
2019-12-18 11:42:08 -05:00
<p>Note that the first child of the &lt;apply-to&gt; should be the fastening type, and the &lt;external&gt; should follow. If a receiving entity finds unknown namespaced elements inside an &lt;apply-to&gt; 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 &lt;external&gt;, and maintain backwards compatibility).</p>
2019-09-11 11:24:28 -04:00
</section2>
2019-12-18 11:42:08 -05:00
<section2 topic="Replacing fastenings" anchor="replace">
<p>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 &lt;apply-to&gt; element then logically replace all fastenings previously applied by the sending entity with the same qualified name (name and namespace).</p>
2019-09-11 11:24:28 -04:00
<p>For example, if user2 wished to update the fastening from the first example they would send:</p>
<example caption="User2 applies"><![CDATA[
2019-09-11 11:57:27 -04:00
<message id="6" from="user2@chatservice.example" to="chatroom@chatservice.example">
2019-12-18 11:42:08 -05:00
<apply-to xmlns="urn:xmpp:fasten:0" id="origin-id-1">
<i-like-this xmlns='urn:example:like'>Very much</i-like-this>
2019-09-11 11:24:28 -04:00
</apply-to>
</message>
2019-12-18 11:42:08 -05:00
]]></example>
</section2>
<section2 topic="Removing fastenings" anchor="remove">
<p>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 &lt;apply-to;&gt; element. This logically replaces all the previous fastenings from this sender of this qualified name with an empty list of fastenings.</p>
<p>For example, if user2 wished to remove the fastenings from the first example they would send:</p>
<example caption="User2 applies"><![CDATA[
<message id="6" from="user2@chatservice.example" to="chatroom@chatservice.example">
<apply-to xmlns="urn:xmpp:fasten:0" id="origin-id-1" clear="true">
<i-like-this xmlns='urn:example:like'/>
</apply-to>
</message>
]]></example>
</section2>
<section2 topic="Interaction with stanza encryption" anchor="encryption">
<p>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 &lt;apply-to&gt; 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 &lt;apply-to&gt; element, which a client MUST use post-decryption and ignore the shell element.</p>
<example caption="Encrypted fastening"><![CDATA[
<message id="9" from="user2@chatservice.example" to="chatroom@chatservice.example">
<apply-to xmlns="urn:xmpp:fasten:0" id="origin-id-1" shell="true"/>
<!--This is encrypted-->
<apply-to xmlns="urn:xmpp:fasten:0" id="origin-id-1">
<i-like-this xmlns='urn:example:like'/>
</apply-to>
<!--end encryption-->
</message>
2019-09-11 11:24:28 -04:00
]]></example>
</section2>
</section1>
<section1 topic='Business Rules' anchor='rules'>
<p>In order for a message to be able to have fastenings applied to it it must contain a &xep0359; stanza id.</p>
<p>A message must only contain a single "apply-to" element (i.e. a message cannot be fastened to multiple other messages).</p>
<p>Fastenings are not to be chained - an &lt;apply-to&gt; element MUST reply to the original message to which it applies, not to an earlier fastening-containing-message (the 'id' attribute of an &lt;apply-to&gt; element must not be that of a stanza that itself contains an &lt;apply-to&gt;). For example, if this spec is used in the future to wrap multiple subsquent message edits for the same source message, each &lt;apply-to&gt; would contain the original stanza's id, not the id of any subsequent fastening stanza.</p>
<p>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.</p>
2019-12-18 11:42:08 -05:00
<p>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.</p>
2019-09-11 11:24:28 -04:00
<p>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).</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<section2 topic='Protocol Namespaces' anchor='ns'>
<p>The &REGISTRAR; includes 'urn:xmpp:fasten:0' in its registry of protocol namespaces (see &NAMESPACES;).</p>
<ul>
<li>urn:xmpp:fasten:0</li>
</ul>
</section2>
</section1>
2019-12-18 11:42:08 -05:00
<section1 topic='Acknowledgements' anchor='ack'>
<p>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.</p>
</section1>
2019-09-11 11:24:28 -04:00
</xep>