Class MessageRetractionManager


  • public final class MessageRetractionManager
    extends org.jivesoftware.smack.Manager
    Smacks API for XEP-0424: Message Retraction. To enable / disable auto-announcing support for this feature, call setEnabledByDefault(boolean). Auto-announcing is enabled by default. To retract a message, call retractMessage(OriginIdElement), passing in the Origin ID of the message to be retracted.
    • Method Detail

      • getInstanceFor

        public static MessageRetractionManager getInstanceFor​(org.jivesoftware.smack.XMPPConnection connection)
      • setEnabledByDefault

        public static void setEnabledByDefault​(boolean enabled)
        Enable or disable auto-announcing support for Message Retraction. Default is disabled.
        Parameters:
        enabled - enabled
      • stopAnnouncingSupport

        public void stopAnnouncingSupport()
        Stop announcing support for Message Retraction.
      • addRetractionElementToMessage

        public static void addRetractionElementToMessage​(OriginIdElement retractedMessageId,
                                                         org.jivesoftware.smack.packet.MessageBuilder carrierMessageBuilder)
        Append a RetractElement wrapped inside a FasteningElement which contains the Origin-ID of the message that will be retracted to the given MessageBuilder.
        Parameters:
        retractedMessageId - OriginID of the message that the user wants to retract
        carrierMessageBuilder - message used to transmit the message retraction to the recipient
      • retractMessage

        public void retractMessage​(OriginIdElement retractedMessageId)
                            throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                   java.lang.InterruptedException
        Retract a message by appending a RetractElement wrapped inside a FasteningElement which contains the Origin-ID of the message that will be retracted to a new message and send it to the server.
        Parameters:
        retractedMessageId - OriginID of the message that the user wants to retract
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - in case the connection is not connected.
        java.lang.InterruptedException - if the thread gets interrupted.