1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-25 02:32:18 -05:00
xeps/xep-0308.xml
2022-05-17 21:02:49 +02:00

170 lines
10 KiB
XML

<?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>Last Message Correction</title>
<abstract>This specification defines a method for indicating that a message is a correction of the last sent message.</abstract>
&LEGALNOTICE;
<number>0308</number>
<status>Draft</status>
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>message-correct</shortname>
&ksmith;
<revision>
<version>1.2.1</version>
<date>2022-05-17</date>
<initials>gh/deuill</initials>
<remark><p>Fix disco#info example to use correct addresses.</p></remark>
</revision>
<revision>
<version>1.2.0</version>
<date>2020-10-20</date>
<initials>gl</initials>
<remark><p>Reword note about how to handle LMC in cases where it is not clear that all recipients support it.</p></remark>
</revision>
<revision>
<version>1.1.0</version>
<date>2019-05-15</date>
<initials>kis, gl</initials>
<remark><p>Clear up confusion about subsequent corrections and ids (it's the payloads getting replaced, not the message identity). Allow corrections from the bare JID unless for group chats.</p></remark>
</revision>
<revision>
<version>1.0</version>
<date>2013-04-08</date>
<initials>psa</initials>
<remark><p>Per a vote of the XMPP Council, advanced specification from Experimental to Draft.</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2013-02-24</date>
<initials>kis</initials>
<remark><p>Updates to address Last Call feedback.</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2011-11-10</date>
<initials>psa</initials>
<remark><p>Initial published version.</p></remark>
</revision>
<revision>
<version>0.0.2</version>
<date>2011-10-30</date>
<initials>kis</initials>
<remark><p>Adding discovery, as discussed as a prerequisite to acceptance with Council.</p></remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2010-07-20</date>
<initials>kis</initials>
<remark><p>First draft.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>When sending a message, people often introduce typing errors and send a follow-up message to correct them. This specification allows the sending client to flag the second message as correcting the first.</p>
</section1>
<section1 topic='Discovering support' anchor='disco'>
<p>If a client implements message correction, it MUST specify the 'urn:xmpp:message-correct: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'
from='romeo@montague.net/orchard'
to='juliet@capulet.net/balcony'
id='info1'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>]]></example>
<example caption='Partner&apos;s client advertises support for correction'><![CDATA[
<iq type='get'
to='romeo@montague.net/orchard'
from='juliet@capulet.net/balcony'
id='info1'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
<feature var='urn:xmpp:message-correct:0'/>
...
</query>
</iq>]]></example>
<p>Message corrections sent to clients that do not support them will be rendered as duplicate (corrected) messages. In most Instant Messaging environments (particularly within a &xep0045; room, but also with a recipient having multiple clients using &xep0280; and &xep0313;) it is unknown whether some or all receiving devices support this extension. It is suggested that a client should always allow sending corrections, but may make the user aware of the potential for duplicate messages to be interpreted by the recipients. In restricted environments, implementors could choose to allow or disallow sending in such cases, as is appropriate for the intended deployments.</p>
</section1>
<section1 topic='Use Case' anchor='usecase'>
<p>When a user indicates to the client that he wants to correct the most recently sent message to a contact, the client will resend the corrected message with a new id, and with the replace payload refering to the previous message by id. The receiving client then treats the newly received payloads as completely replacing all payloads of the original message.</p>
<example caption='User sends a message with a mistake in'><![CDATA[
<message to='juliet@capulet.net/balcony' id='bad1'>
<body>But soft, what light through yonder airlock breaks?</body>
</message>]]></example>
<example caption='User corrects the message and sends'><![CDATA[
<message to='juliet@capulet.net/balcony' id='good1'>
<body>But soft, what light through yonder window breaks?</body>
<replace id='bad1' xmlns='urn:xmpp:message-correct:0'/>
</message>]]></example>
</section1>
<section1 topic='Business Rules' anchor='rules'>
<p>The 'id' attribute is included on the replace to prevent situations where messages being routed to a different resource than the intended cause incorrect replacements.</p>
<p>A receiving client can choose to replace the previous message in whatever display is used for messages, or in any stored history, or can choose to display the correction in another way.</p>
<p>A client SHOULD alert the user that the displayed message has been edited since it was originally sent.</p>
<p>Clients MUST send ids on messages if they allow the user to correct messages.</p>
<p>To deal with multiple payloads, the sender MUST re-send the entire stanza, only altering id and the payloads being corrected and adding the 'replace' payload. It is expected that the receiver SHOULD then treat the new stanza as complete replacement for all the payloads received in the original stanza.</p>
<p>The Sender MUST NOT include a correction for a message with non-messaging payloads. For example, a sender MUST NOT include a correction for a roster item exchange request or a file transfer part.</p>
<p>A single message may be corrected multiple times by subsequent edits.</p>
<p>A correction MUST only be allowed when both the original message and correction originate from the same sender<note>In direct conversations, this means the bare-JID must match the original bare-JID, in MUCs and MUC-PMs the correction's full-JID must match the original full-JID, and the recipient needs to ensure that the real bare JID of the sending occupant didn't change in between, e.g. by keeping track of leave/join presences.</note>.</p>
<p>While it's not possible to prevent this protocol from being used in such a way, it is not intended that it provides a way to continue expanding a previous message indefinitely and clients, in as much as it is sensible, should present use of this extension only for correction rather than for providing a continuous stream, for which &xep0301; can be used instead.</p>
<p>If the same message is to be corrected several times, the id of the original message is used in each case (e.g. If a message of id 1 is corrected by a message of id 2, a subsequent correction should correct 1, not 2).</p>
<p>Correction MUST only be used to change the logical content details of a stanza (e.g. the message body) and not to change the nature of the stanza or its metadata (e.g. correction MUST NOT be used to turn a chat message into a pubsub notification). Where a correction stanza includes metadata, for example stanza or MAM ids, these are properties of the correction stanza, and do not correct aspects of the original stanza.</p>
<p>While it is possible to use this protocol to correct messages older than the most recent received from a full JID, such use is out of scope for this document and support for this SHOULD NOT be assumed without further negotiation.</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>The replacement message could have an entirely different meaning from the original message, so clients will need to make users aware that the displayed message has been edited. It is also suggested that clients make the original message available in some way, although this UI consideration is out of the scope of this document.</p>
<p>There exist some payload types where correction is problematic, for some deployments. In particular, care needs to be taken that security labels from &xep0258; are handled in an appropriate manner for the security domains of a given deployment.</p>
<p>When used in a &xep0045; context, corrections must not be allowed (by the receiver) for messages received before the sender joined the room - particularly a full JID leaving the room then rejoining and correcting a message SHOULD be disallowed, as the entity behind the full JID in the MUC may have changed.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>None.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<section2 topic='Protocol Namespaces' anchor='ns'>
<p>The &REGISTRAR; includes 'urn:xmpp:message-correct:0' in its registry of protocol namespaces (see &NAMESPACES;).</p>
<ul>
<li>urn:xmpp:message-correct:0</li>
</ul>
</section2>
<section2 topic='Protocol Versioning' anchor='registrar-versioning'>
&NSVER;
</section2>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:xmpp:message-correct:0'
xmlns='urn:xmpp:message-correct:0'
elementFormDefault='qualified'>
<xs:element name='replace'>
<xs:complexType>
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:attribute name='id' type='xs:string' use='required'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
]]></code>
</section1>
<section1 topic='Acknowledgements' anchor='ack'>
<p>The author thanks those who provided feedback during Last Call: Kurt Zeilenga, Philipp Hancke, Dave Cridland, Mark Rejhon, Gunnar Helström, Andreas Kuckartz, Matthew Miller, Kim Alvefur and Peter Saint-Andre.</p>
</section1>
</xep>