<p>Occasionally, a &xep0045; moderator might wish to moderate certain groupchat messages by, for example, retracting them from the groupchat history as part of an effort to address and remedy issues such as message spam, indecent language for the venue or exposing private third-party personal information. Alternatively, a moderator might want to correct a message on another user's behalf, or flag a message as inappropriate without requiring that it be retracted.</p>
<p>Due to the federated nature of XMPP and as with any content moderation tool, the moderation request can <strong>only be considered as a hint</strong> and clients which don't support message moderation are not obligated to enforce any such request.</p>
<p>If a client or service implements message moderation, it MUST specify the 'urn:xmpp:message-moderate:0' feature in its service discovery information features as specified in &xep0030; and the Entity Capabilities profile specified in &xep0115;.</p>
<examplecaption='Client requests information from a groupchat service'><![CDATA[
<p>Consider a situation where a user sends a message that may be deemed inappropriate by a groupchat moderator. The groupchat service will append a &xep0359; stanza ID to the message before relaying it to all participants.</p>
<p>The moderator sees the message and indicates to their client that the message should be retracted. The client then sends an IQ stanza to the MUC service, requesting that the message be retracted.</p>
<examplecaption="The moderator's client sends an IQ stanza to the MUC service"><![CDATA[
<p>If the moderator is allowed to moderate the message, the groupchat service will send a message stanza to all participants (including the moderator), indicating that the message has been retracted and by whom.</p>
<p>A &xep0313; service MAY replace the contents of a message, that was retracted due to moderation, with a 'tombstone' similar to the one described in &xep0424;.</p>
<p>The archiving service replaces the message contents (i.e. the <body/> and any related elements which might leak information about the original message) with a <moderated/> element which in turn contains a <retracted/> element. The <moderated/> element MUST have a 'by' attribute specifying the JID of the moderating entity.</p>
<p>If the message was sent in a semi-anonymous MUC, the occupant id from &xep0421; SHOULD be included for the moderator and the message author in the <moderated/> and <retracted/> elements respectively. </p>
<p>A moderator MUST NOT send a moderation request for a message with non-messaging payloads. For example, a moderator MUST NOT moderate a roster item exchange request or a file transfer part.</p>
<p>In MUCs, only moderation messages (not tombstones, but messages containing the <moderate/> element) received from the MUC service itself are legitimate, all other such messages MUST be discarded.</p>
<p>If message moderation includes a retraction request, the MUC or other service that supports message retraction SHOULD prevent further distribution of the retracted message by the service and the archiving service MAY replace the retracted message with a tombstone as detailed in &xep0424;.</p>
<p>There can never be a guarantee that a moderated message will appear as such in all clients. Clients should therefore, when possible, inform users that no such guarantee exists.</p>
<p>To prevent message spoofing, it's very important to check that the moderation message comes from the MUC service (as explained in the <linkurl='#rules'>Business Rules</link> section).</p>