1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-08-13 16:53:48 -04:00

Merge pull request #1249 from truenicoco/reaction-restriction

XEP-0444: Add restrictions to reactions
This commit is contained in:
Kevin Smith 2023-02-28 17:43:24 +00:00 committed by GitHub
commit 058ee26930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,12 @@
<email>xsf@larma.de</email>
<jid>jabber@larma.de</jid>
</author>
<revision>
<version>0.2.0</version>
<date>2022-12-30</date>
<initials>NC</initials>
<remark>Add emoji rejection mechanism.</remark>
</revision>
<revision>
<version>0.1.1</version>
<date>2022-12-30</date>
@ -75,19 +81,20 @@
</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[
<section2 topic="Basic support" anchor="disco-base">
<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[
<example caption='Partner&apos;s client advertises support for reactions'><![CDATA[
<iq type='result'
to='juliet@capulet.lit/balcony'
from='romeo@montague.lit/orchard'
@ -97,7 +104,48 @@
<feature var='urn:xmpp:reactions:0'/>
...
</query>
</iq>]]></example>
</section2>
<section2 topic="Restricted reactions" anchor="disco-restricted">
<p>
In some cases, only a limited number and/or subset
of emojis are allowed to react to a message.
This is particularly useful in the context of gateways to other chat
networks that are not as permissive about which and how many emojis
can be used for message reactions.
MUC components may also allow room admins to restrict the subset and/or number
of emojis per message.
</p>
<p>
To allow clients to adapt their UIs, entities that have such restrictions in place
SHOULD advertise it with &xep0128; in a &xep0004; using the
'urn:xmpp:reactions:0:restrictions' namespace as FORM_TYPE.
</p>
<example caption='Entities advertises support for restricted 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'/>
<x xmlns='jabber:x:data' type='result'>
<field var='FORM_TYPE' type='hidden'>
<value>urn:xmpp:reactions:0:restrictions</value>
</field>
<field var='max_reactions_per_user'>
<value>1</value>
</field>
<field var='allowlist'>
<value>💘</value>
<value>❤️</value>
<value>💜</value>
</field>
</x>
...
</query>
</iq>]]></example>
</section2>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
<section2 topic="Sending reactions to a message" anchor="sending-reactions">
@ -146,6 +194,48 @@
<store xmlns="urn:xmpp:hints"/>
</message>]]></example>
</section2>
<section2 topic="Rejecting a reaction" anchor="rejecting">
<p>
Entities implementing reaction restrictions MUST reply to invalid reactions payloads
with a message type="error" containing a 'not-acceptable' error.
The error payload SHOULD contain a human-readable text message explaining the reaction rules.
</p>
<example caption="Romeo sends a message"><![CDATA[
<message from="romeo@legacy-love-network.capulet.net"
to='juliet@capulet.net'
id='restricted-reactions-1'
type='chat'>
<body>I shall only accept heart emojis as reactions</body>
</message>]]></example>
<example caption="Juliet reacts with both a 💘 and a 💜"><![CDATA[
<message from="juliet@capulet.net"
to='romeo@legacy-love-network.capulet.net'
id='will-be-rejected1'
type='chat'>
<reactions id='restricted-reactions-1' xmlns='urn:xmpp:reactions:0'>
<reaction>💘</reaction>
<reaction>💜</reaction>
</reactions>
<store xmlns="urn:xmpp:hints"/>
</message>]]></example>
<example caption="Romeo rejects the reactions"><![CDATA[
<message from="romeo@legacy-love-network.capulet.net"
to="juliet@capulet.net"
type="error"
id="will-be-rejected1">
<error xmlns="jabber:client" type="modify">
<not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
Only 💘, ❤️ and 💜 are allowed as reactions on this legacy IM network,
and you can only use a single emoji at once.
</text>
</error>
</message>]]></example>
<p>
When receiving this error message, the reaction-sending entity MUST revert the "message reactions"
to its previous state in its user interface.
</p>
</section2>
</section1>
<section1 topic='Business Rules' anchor='rules'>
<p>Messages MUST NOT contain more then one &lt;reactions&gt; element</p>