<?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 Deletion</title>
  <abstract>This specification defines a method for indicating that a message should be removed.</abstract>
  &LEGALNOTICE;
  <number>XXXX</number>
  <status>Experimental</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP Core</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>message-delete</shortname>
  &lance;
  <revision>
    <version>0.0.1</version>
    <date>2015-07-07</date>
    <initials>ljts</initials>
    <remark><p>First draft.</p></remark>
  </revision>
</header>
<section1 topic='Introduction' anchor='intro'>
  <p>Occasionally, a &xep0045; room moderator or admin might wish to remove certain chat messages from the room history as part of an effort to address and remedy issues such as message spam, indecent language for the venue, exposing private third-party personal information, etc. However, as with any content moderation tool, the removal request can <strong>only be considered as a hint</strong> and by itself can not prevent or undo any potential damage caused by the offending message, as clients which don't support message deletion are not obligated to enforce the deletion request and people could have seen or copied the message content already.</p> 
</section1>
<section1 topic='Discovering support' anchor='disco'>
  <p>If a client or service implements message deletion, it MUST specify the 'urn:xmpp:message-delete: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'
    id='info1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>]]></example>
    <example caption='Partner&apos;s client advertises support for removal'><![CDATA[
<iq type='get'
    to='romeo@montague.net/home'
    from='montague.net'
    id='info1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
...
    <feature var='urn:xmpp:message-delete:0'/>
...
  </query>
</iq>]]></example>
</section1>
<section1 topic='Use Case' anchor='usecase'>
    <p>When a user indicates to the client that a sent message (or a received message for MUC room moderators) is meant to be deleted, the client will send a new message containing a &lt;remove /&gt; element with the "urn:xmpp:message-delete:0" namespace, with an id attribute set to the id of the message to be removed.</p>
  <example caption='User sends a message with a mistake in'><![CDATA[
<message to='room@muc.example.com' id='bad1'>
  <body>This message contained information not meant for this room.</body>
</message>]]></example>
<example caption='User inidcates that the message should be removed'><![CDATA[
<message to='room@muc.example.com' id='remove1'>
  <remove id='bad1' xmlns='urn:xmpp:message-delete:0'/>
</message>]]></example>
</section1>
<section1 topic='Business Rules' anchor='rules'>
  <p>A receiving client can choose to remove the indicated message from whatever display is used for messages, from any stored history, or choose to display the fact that a message has been removed in another way.</p>
  <p>A MUC or other service that supports message removal SHOULD prevent further distribution of the message by the service (e.g., by not replaying the message to new occupants joining the room, or omitting the message from history archive requests where possible).</p>
  <p>A client MAY inform the user that a no-longer displayed message did previously exist and has been removed.</p>
  <p>Clients and services MUST set the 'id' attribute on messages if they allow for message deletion.</p>
  <p>The Sender MUST NOT send a removal request for a message with non-messaging payloads. For example, a sender MUST NOT send a removal for a roster item exchange request or a file transfer part.</p>
  <p>A removal MUST only be processed when both the original message and removal request are received from the same full-JID (or from a JID of an appropriate admin or moderator in the case of a MUC room.)</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
  <p>There can never be a guarantee that a removed message was never seen or otherwise distributed, and it is encouraged for clients and services when possible to inform users that no such guarantee exists.</p>
  <p>When used in a &xep0045; context, removals send by non-moderators 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 removing 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-delete:0' in its registry of protocol namespaces (see &NAMESPACES;).</p>
    <ul>
      <li>urn:xmpp:message-delete: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-delete:0'
    xmlns='urn:xmpp:message-delete:0'
    elementFormDefault='qualified'>

  <xs:element name='remove'>
    <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>
</xep>
