Merge branch 'feature/xep-0372' into premerge

This commit is contained in:
Jonas Schäfer 2020-12-08 15:06:01 +01:00
commit ca99d95c80
1 changed files with 12 additions and 2 deletions

View File

@ -11,7 +11,7 @@
<abstract>This document defines a method for one XMPP stanza to provide references to another entity, such as mentioning users, HTTP resources, or other XMPP resources.</abstract>
&LEGALNOTICE;
<number>0372</number>
<status>Deferred</status>
<status>Experimental</status>
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
@ -25,6 +25,12 @@
<supersededby/>
<shortname>Refs</shortname>
&ksmithisode;
<revision>
<version>0.4.0</version>
<date>2020-12-08</date>
<initials>gh/jcbrand</initials>
<remark>Specify that begin is inclusive, starts counting at zero, and that end is exclusive (Dijkstra-based convention)</remark>
</revision>
<revision>
<version>0.3</version>
<date>2019-09-04</date>
@ -92,7 +98,11 @@
<section1 topic='Use Cases' anchor='usecases'>
<section2 topic='Generics' anchor='usecase_generics'>
<p>References are provided in a 'reference' element of a message, with a namespace of 'urn:xmpp:reference:0'. The element MUST contain a type attribute denoting the type of the reference and a uri attribute of the thing that is referenced. It MAY contain begin, end and anchor elements. A begin attribute is used to mark the index in the body of the referring message of the first character (TODO: define character appropriately) in the reference, with 0 being the index of the first character. An end attribute is similarly used for the index of the last character of the reference. Where the reference is not a substring of the message body in the referring stanza, begin and end are not used. An anchor attribute is used when the referring message is not the one containing the reference element, and points to the previous message containing the reference (the referring message).</p>
<p>References are provided in a 'reference' element of a message, with a namespace of 'urn:xmpp:reference:0'. The element MUST contain a 'type' attribute denoting the type of the reference and a 'uri' attribute of the thing that is referenced. It MAY contain 'begin', 'end' and 'anchor' elements.</p>
<p>The 'begin' and 'end' attributes are indexes denoting the beginning and end of the referenced substring in the message body. The Dijkstra convention of ranges<note>Dijkstra convention of ranges &lt;<link url='https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html'>https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html</link>&gt;</note> is used, which means that 'begin' is inclusive and 'end' is exclusive. In other words, the 'begin' attribute is the index of the first character (TODO: define character appropriately) in the referenced substring, with 0 being the index of the first character in the body, and the 'end' attribute is one higher than the index of the last character in the substring.
This convention has three main advantages. It matches subsequence indexing in various programming languages, 'end' minus 'begin' equals the length of the substring, and when two substrings are adjacent, the 'end' attribute of the first one matches the 'begin' attribute of the second one.
Where the reference is not a substring of the message body in the referring stanza, 'begin' and 'end' are not used.</p>
<p>An 'anchor' attribute is used when the referring message is not the one containing the reference element, and points to the previous message containing the reference (the referring message).</p>
<p>Note that the URIs of the reference and anchor do not need to refer to the same mechanism as that in which the reference was received. E.g., a service could listen for mentions in a MIX channels of users outside that channel, and send them messages containing a reference to let them know that they've been mentioned.</p>
</section2>
<section2 topic='Mentions' anchor='usecase_mention'>