%ents; ]>
References 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. &LEGALNOTICE; 0372 Experimental Standards Track Standards Council XMPP Core XMPP IM XEP-0030 XEP-0115 Refs &ksmithisode; 0.5.0 2020-12-09 kis Specify counting should be of code points. 0.4.0 2020-12-08 gh/jcbrand Specify that begin is inclusive, starts counting at zero, and that end is exclusive (Dijkstra-based convention). 0.3 2019-09-04 (mb) Make Pubsub URIs in sections 3.3 and 3.4 conform to XEP-0147. 0.2 2017-09-11 XEP Editor (jwi) Defer due to lack of activity. 0.1 2016-03-22 XEP Editor (asw)

Initial published version approved by the XMPP Council.

0.0.1 2016-01-29 kis

First draft.

It's often desirable to encode a reference to another entity within a chat message and to mark up the reference. Examples of this include HTTP URLs, 'mentions' (referring to another user), references to previous messages and references to &xep0346; (FDP) forms. This document provides a mechanism for marking up a section of a message body with information about the target of the reference.

If a client implements references, it MUST specify the 'urn:xmpp:reference:0' feature in its service discovery information features as specified in &xep0030; and the Entity Capabilities profile specified in &xep0115;.

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

TODO: Individual discovery of reference types - FDP, Mentions, ...

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.

The 'begin' and 'end' attributes are indexes denoting the beginning and end of the referenced substring in the message body. The Dijkstra convention of rangesDijkstra convention of ranges <https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html> is used, which means that 'begin' is inclusive and 'end' is exclusive. In other words, the 'begin' attribute is the index of the first unicode code point in the referenced substring, with 0 being the index of the first code point in the body, and the 'end' attribute is one higher than the index of the last code point 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.

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).

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.

Mentions are a reference to a user's bare JID, and have a type of 'mention'.

But, soft! what light through yonder window breaks? It is the east, and Juliet is the sun. ]]>

Data references are a generic reference without additional information. The URI points to an 'item' that is able to be fetched. This is useful for, for example, fetching an item from pubsub, as in the example below. TODO: check URI syntax for refering to a pubsub item.

Form received ]]>

Sometimes it's desirable to annotate a reference in a previous message. An example of this might be where a MIX channel asynchronously adds information about references made in previous messages by users. In this case the message MUST NOT contain a body. Here the anchor attribute is used to provide a URI to the previous message. TODO: URI scheme for messages.

]]>

TODO.

None.

Needs a namespace.

When advanced.