Search in sources :

Example 1 with RetractElement

use of org.jivesoftware.smackx.message_retraction.element.RetractElement in project Smack by igniterealtime.

the class MessageRetractionManager method addRetractionElementToMessage.

/**
 * Append a {@link RetractElement} wrapped inside a {@link FasteningElement} which contains
 * the {@link OriginIdElement Origin-ID} of the message that will be retracted to the given {@link MessageBuilder}.
 *
 * @param retractedMessageId {@link OriginIdElement OriginID} of the message that the user wants to retract
 * @param carrierMessageBuilder message used to transmit the message retraction to the recipient
 */
public static void addRetractionElementToMessage(OriginIdElement retractedMessageId, MessageBuilder carrierMessageBuilder) {
    FasteningElement fasteningElement = FasteningElement.builder().setOriginId(retractedMessageId).addWrappedPayload(new RetractElement()).build();
    fasteningElement.applyTo(carrierMessageBuilder);
}
Also used : FasteningElement(org.jivesoftware.smackx.message_fastening.element.FasteningElement) RetractElement(org.jivesoftware.smackx.message_retraction.element.RetractElement)

Aggregations

FasteningElement (org.jivesoftware.smackx.message_fastening.element.FasteningElement)1 RetractElement (org.jivesoftware.smackx.message_retraction.element.RetractElement)1