Class Replace


  • public final class Replace
    extends Object
    The implementation of the <replace/> element in the urn:xmpp:message-correct:0 namespace.

    Advertising Support for Message Correction

    
     xmppClient.enableFeature(Replace.NAMESPACE);
     

    Checking if a Message Should be Corrected

    
     Replace replace = message.getExtension(Replace.class);
     if (replace != null) {
         String oldMessageId = replace.getId();
         // Replace old message with message...
     }
     

    Correcting a Message

    
     Message correctedMessage = new Message(jid, Message.Type.CHAT, "This is the corrected text");
     correctedMessage.addExtension(new Replace(id));
     xmppClient.send(correctedMessage);
     

    This class is immutable.

    See Also:
    XEP-0308: Last Message Correction, XML Schema
    • Constructor Detail

      • Replace

        public Replace​(String id)
        Parameters:
        id - The id of the message which shall be corrected.
    • Method Detail

      • getId

        public final String getId()
        Gets the id of the message which shall be corrected.
        Returns:
        The message id.