<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>
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.
</p>
</section1>
<!--<section1 topic='Requirements' anchor='reqs'>
<ul>
<li></li>
</ul>
</section1>-->
<section1topic='Discovery'anchor='discovery'>
<p>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;.</p>
<examplecaption='Client queries for contact&s features'><![CDATA[
<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>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>
<p>Mentions are a reference to a user's bare JID, and have a type of 'mention'.</p>
<examplecaption='Romeo sends a message mentioning Juliet'><![CDATA[
<messagetype='groupchat'
id='sotehu-bthbtp32h3'
to='balcony@channels.shakespeare.lit'>
<body>But, soft! what light through yonder window breaks? It is the east, and Juliet is the sun.</body>
<referencexmlns='urn:xmpp:reference:0'
begin='72'
end='78'
type='mention'
uri='xmpp:juliet@capulet.lit'/>
</message>
]]></example>
</section2>
<section2topic='Data'anchor='usecase_data'>
<p>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.</p>
<examplecaption='A MIX Channel sends a message that a new FDP form has been submitted elsewhere'><![CDATA[
<p>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.</p>
<examplecaption='A MIX Channel annotates a previous user message'><![CDATA[