You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

231 lines
8.2 KiB

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<title>Message Attaching</title>
This specification defines a method for indicating that a message contains
content which describes an earlier message in the conversation and should
be grouped with the earlier message.
<type>Standards Track</type>
<spec>XMPP Core</spec>
<remark>Update to use unique stanza ids.</remark>
<initials>XEP Editor (jwi)</initials>
<remark>Defer due to lack of activity.</remark>
<initials>XEP Editor (asw)</initials>
<remark><p>Initial published version approved by the XMPP Council.</p></remark>
<remark><p>First draft.</p></remark>
<section1 topic='Introduction' anchor='intro'>
Many messaging applications send special messages which include more
information about a previous message. For example, when sending a link the
service may display the description or an image off the page, or users may
respond to a message with a "sticker" or an "emotion" which they wish to
display alongside the message, even though the conversation has moved on.
This specification defines a way by which one can indicate that a message
is logically (and visibly) "attached" to an earlier message in the
<section1 topic='Discovering support' anchor='disco'>
If a client implements message attaching, it MUST specify the
'urn:xmpp:message-attaching:1' feature in its service discovery information
features as specified in &xep0030; and the Entity Capabilities profile
specified in &xep0115;.
<example caption='Client requests information about a chat partner&apos;s client'><![CDATA[
<iq type='get'
<query xmlns=''/>
<example caption='Partner&apos;s client advertises support for attaching'><![CDATA[
<iq type='result'
<query xmlns=''>
<feature var='urn:xmpp:message-attaching:1'/>
<section1 topic='Usage' anchor='usage'>
Messages that are attached to other messages MUST contain an
&lt;attach-to/&gt; element qualified by the 'urn:xmpp:message-attaching:1'
namespace and with an 'id' attribute set to the ID of the message that we
want to attach to (important note: the correct ID to use depends on the context,
see the business rules below). Messages MAY be attached to any
other message, including those sent by other clients, but clients MAY choose
to ignore the attach-to directive and display the message normally.
<example caption='User attaches a message'><![CDATA[
<message to='antonio@milan.lit/ship' from='prospero@milan.lit/island' id='RgEGnjqy'>
<attach-to id='SD24VCzSYQ' xmlns='urn:xmpp:message-attaching:1'/>
Note that indicating that a message should be "attached" to an earlier
message in the conversation is merely a suggestion to the client to display
the message next to or below the old message.
<section1 topic='Business Rules' anchor='rules'>
<section2 topic='Using the correct ID' anchor='business-id'>
For messages of type 'groupchat', the stanza's 'id' attribute MUST NOT be
used for attachments. Instead, in group chat situations, the ID assigned to
the stanza by the group chat itself must be used. This is discovered in a
&lt;stanza-id&gt; element with a 'by' attribute that matches the bare JID of
the group chat, as defined in &xep0359;.
This implies that group chat messages without a &xep0359; stanza-id cannot
be attached-to.
For other message types the attacher should use the 'id' from a XEP-0359
&lt;origin-id&gt; if present, or the value of the 'id' attribute on the
&lt;message&gt; otherwise.
<section2 topic='Display of attached messages' anchor='business-display'>
A receiving client MAY choose to show the attached message next to or below
the indicated message in whatever display is used for messages or can
choose to display the attachment in another way (including as a normal
message, completely ignoring the attach-to element).
A receiving client SHOULD indicate that the message is an attachment, and
not a part of the original message to prevent confusion.
<section2 topic='General' anchor='business-general'>
&lt;attach-to/&gt; elements MUST NOT be put on any stanza type other than
A server may choose to strip some &lt;attach-to/&gt; messages based on
local policy (eg. a server might have a policy that only it can create
message attachments).
<p>Clients MUST send ids on messages if they support attachments.</p>
Messages MUST NOT contain more than one &lt;attach-to/&gt; element.
Clients and servers MUST NOT include an &lt;attach-to/&gt; element on
messages with a non-messaging payload unless they are including it on an
error which may be attached to the message that caused the error to be
<section1 topic='Security Considerations' anchor='security'>
Clients that implement message attachments MUST display the attachments
in such a way that they could not be confused with the original message
and cause someone viewing the conversation to assume they were sent by
the sender of the message being attached to.
When matching a received attachment to the original message, clients must
ensure they match using the correct ID, as described in the business rules
section, e.g. within a group chat only the XEP-0359 stanza-id should be
matched against. If this is not available, the message SHOULD be displayed
as a normal unattached message.
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<p>This specification defines the following XML namespaces:</p>
The &REGISTRAR; shall include the foregoing namespaces in its disco
features registry as defined in &xep0030;.
<code caption='Registry Submission'><![CDATA[
<desc>Indicates support for attaching one message to another.</desc>
<section1 topic='XML Schema' anchor='schema'>
<?xml version='1.0' encoding='UTF-8'?>
<xs:element name='attach-to'>
<xs:extension base='xs:string'>
<xs:attribute name='id' type='xs:string' use='required'/>