1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-12-04 15:02:19 -05:00
xeps/inbox/reactions.xml

232 lines
9.6 KiB
XML
Raw Normal View History

2019-07-14 12:51:08 -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 Reactions</title>
<abstract>This specification defines a way for adding reactions to a message.</abstract>
&LEGALNOTICE;
<number>xxxx</number>
<status>ProtoXEP</status>
<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-0203</spec>
<spec>XEP-0334</spec>
<spec>XEP-0359</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>reactions</shortname>
<author>
<firstname>Natalie</firstname>
<surname>Wirth</surname>
<email>xsf@larma.de</email>
</author>
<author>
<firstname>Marvin</firstname>
<surname>Wissfeld</surname>
<email>xsf@larma.de</email>
<jid>jabber@larma.de</jid>
</author>
<revision>
<version>0.0.1</version>
<date>2019-07-14</date>
<initials>nw/mw</initials>
<remark><p>First draft.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>
Message reactions allow to express an opinion or feeling towards a message
in a quick and light-weight way. Reactions are described in the form of
emojis and can enhance communication especially when chatting with multiple
parties. Other possible uses include voting and checking to-do list items.
</p>
<p>
Reactions are typically displayed in a summarizing fashion visually attached
to the message they belong to.
</p>
<p>
Related work has been done in &xep0367;. However, it can't be used for
reactions, as it would cause difficulties with non-supporting clients, is
not tailored to emojis and does not specify removal of reactions. To solve
these issues, this XEP introduces a separate XML element for reactions.
</p>
</section1>
<section1 topic='Discovering support' anchor='disco'>
<p>
If a client implements message reactions, it MUST specify the
'urn:xmpp:reactions: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 reactions'><![CDATA[
<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:reactions:0'/>
...
</query>
</iq>]]></example>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
<section2 topic="Sending reactions to a message" anchor="sending-reactions">
<p>
When a user chooses to react to a message with a certain emoji, the
client sends a &lt;message&gt; stanza containing a &lt;reactions&gt;
element. The chosen emoji is included in a &lt;reaction&gt; element within
the &lt;reactions&gt; element. The message is referred to by including its
id or in MUCs its stanza-id as defined in &xep0359; in the 'id' attribute
of the reactions element.
</p>
<example caption="Romeo sends a message"><![CDATA[
<message to='juliet@capulet.net/balcony' id='744f6e18-a57a-11e9-a656-4889e7820c76' type='chat'>
<body>Hello, world!</body>
</message>]]></example>
<example caption="Juliet sends a 👋 reaction to the message"><![CDATA[
<message to='romeo@capulet.net/orchard' id='7fdd29fa-a57a-11e9-b04a-4889e7820c76' type='chat'>
<reactions id='744f6e18-a57a-11e9-a656-4889e7820c76' xmlns='urn:xmpp:reactions:0'>
<reaction>👋</reaction>
</reactions>
<store xmlns="urn:xmpp:hints"/>
</message>]]></example>
</section2>
<section2 topic="Updating reactions to a message" anchor="updating-reactions">
<p>
If the user chooses to remove reactions from or add reactions to a
message they have already reacted to, the client sends a &lt;message&gt;
with all &lt;reaction&gt; elements that are (still or newly) applicable
to that message.
</p>
<example caption="Juliet adds a 🐢 reaction to the message"><![CDATA[
<message to='romeo@capulet.net/orchard' id='96d73204-a57a-11e9-88b8-4889e7820c76' type='chat'>
<reactions id='744f6e18-a57a-11e9-a656-4889e7820c76' xmlns='urn:xmpp:reactions:0'>
<reaction>👋</reaction>
<reaction>🐢</reaction>
</reactions>
<store xmlns="urn:xmpp:hints"/>
</message>]]></example>
<p>
In order to remove all reactions from a message, an empty
&lt;reactions&gt; element is sent.
</p>
<example caption="Juliet removes all reactions from the message"><![CDATA[
<message to='romeo@capulet.net/orchard' id='973c9d2e-a57a-11e9-af82-4889e7820c76' type='chat'>
<reactions id='744f6e18-a57a-11e9-a656-4889e7820c76' xmlns='urn:xmpp:reactions:0'/>
<store xmlns="urn:xmpp:hints"/>
</message>]]></example>
</section2>
</section1>
<section1 topic='Business Rules' anchor='rules'>
<p>Messages MUST NOT contain more then one &lt;reactions&gt; element</p>
<p>
A message containing a &lt;reactions&gt; element SHOULD be of type 'chat'
or 'groupchat'.
</p>
<p>
A &lt;reaction&gt; element SHOULD only contain Unicode codepoints that can
be displayed as a single emoji, as specified in the latest revision of the
<link url="http://www.unicode.org/reports/tr51/">Unicode® Technical Standard #51</link> <note>Unicode® Technical Standard #51 &lt;<link url="http://www.unicode.org/reports/tr51/">http://www.unicode.org/reports/tr51/</link>&gt;.</note>.
Receiving entities MAY ignore &lt;reaction&gt; elements that do not comply
with this specification.
</p>
<p>
A receiving client SHOULD show reactions attached to the message they where
in response to. Reactions MAY be displayed in a summarized fashion.
</p>
<p>
A &lt;reactions&gt; element MUST NOT contain the same reaction more than
once. A receiving entity SHOULD ignore duplicate reactions inside a
&lt;reactions&gt; element.
</p>
<p>
The sending entity SHOULD add a &lt;store/&gt; hint, as defined in &xep0334;,
if the message being reacted to does not carry a &lt;no-store/&gt; hint.
</p>
<p>
If a message is updated using &xep0308;, the 'id' attribute of the
&lt;reactions&gt; element SHOULD reference the original message id.
A receiving entity SHOULD accept messages with a &lt;reactions&gt; element
referencing a message correction and SHOULD handle such element as if
it was using the message id of the original message.
</p>
<section2 topic='Acceptable reactions' anchor='acceptable-reactions'>
<p>
In direct conversations, a reaction MUST only be accepted if the senders
bare JID matches the bare JID of any of the two involved parties.
</p>
<p>
In MUCs and MUC PMs, the recipient SHOULD ensure that the real bare JID of
the sending occupant did not already send a reaction to that message to
accept it as a new reaction, e.g. by keeping track of leave/join
presences since the message was send. This implies that in semi-anonymous
MUCs it MAY be impossible to attach reactions to a message received from
the history. A reaction MAY still be a valid reaction update (as per the
next paragraph) if it was not accepted as a new reaction.
</p>
<p>
A reaction MUST only be considered an update if it orignates from the same
sender as a previous reaction message. In direct conversations, this means
the bare JID MUST match the original bare JID. In MUCs and MUC PMs the
senders full JID MAY not match the original full JID, but the recipient
MUST ensure that the real bare JID of the sending occupant is the same as
the real bare JID of the previous reaction message, e.g. by keeping track
of leave/join presences.
</p>
<p>
If a message containing a &lt;reactions&gt; element arrives delayed, which
means it carries a &lt;delay/&gt; element, as defined in &xep0203; it SHOULD
only be accepted, if no newer reaction from the same sender was already
accepted.
</p>
</section2>
<section2 topic='Using the correct ID' anchor='business-id'>
<p>
For messages of type 'groupchat', the stanza's 'id' attribute MUST NOT be
used for reactions. 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;.
</p>
<p>
This implies that group chat messages without a &xep0359; stanza-id cannot
be reacted to.
</p>
<p>
For other message types the sender should use the 'id' from a &xep0359;
&lt;origin-id&gt; if present, or the value of the 'id' attribute on the
&lt;message&gt; otherwise.
</p>
</section2>
</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:reactions:0' in its registry of protocol namespaces (see &NAMESPACES;).</p>
<ul>
<li>urn:xmpp:reactions:0</li>
</ul>
</section2>
</section1>
</xep>