Class DelayedDelivery


  • public final class DelayedDelivery
    extends Object
    The implementation of the <delay/> element in the urn:xmpp:delay namespace.

    2. Protocol Definition

    The XML namespace defined herein is used to provide timestamp information about data stored for later delivery. The most common uses of this namespace are to stamp:

    • A message that is sent to an offline entity and stored for later delivery (see Best Practices for Handling Offline Messages).
    • The last available presence stanza sent by a connected client to a server.
    • Messages cached by a Multi-User Chat room for delivery to new participants when they join the room.
    This class is immutable.
    See Also:
    XEP-0203: Delayed Delivery, XML Schema
    • Constructor Detail

      • DelayedDelivery

        public DelayedDelivery​(Instant timestamp)
        Creates a element with only a timestamp attribute.
        Parameters:
        timestamp - The timestamp.
      • DelayedDelivery

        public DelayedDelivery​(Instant timestamp,
                               Jid from,
                               String reason)
        Creates a delayed delivery element with all attributes.
        Parameters:
        timestamp - The timestamp.
        from - The sender.
        reason - The reason.
    • Method Detail

      • sendDate

        public static Instant sendDate​(Stanza stanza)
        Gets the original send date of a stanza, i.e. Instant.now(), if no delayed deliver information is available or the timestamp of delayed delivery.
        Parameters:
        stanza - The stanza.
        Returns:
        The original send date of a stanza or Instant.now().
      • getFrom

        public final Jid getFrom()
        Gets the Jabber ID of the entity that originally sent the XML stanza or that delayed the delivery of the stanza (e.g., the address of a multi-user chat room).
        Returns:
        The entity who originally sent the XML stanza.
      • getTimeStamp

        public final Instant getTimeStamp()
        Gets the time when the XML stanza was originally sent.
        Returns:
        The time when the XML stanza was originally sent.
      • getReason

        public final String getReason()
        Gets the natural-language description of the reason for the delay.
        Returns:
        The natural-language description of the reason for the delay.