Class CsiManager

  • public class CsiManager
    extends Object
    Handles Client State Indication nonzas for one particular client session.
    Guus der Kinderen,
    See Also:
    XEP-0352: Client State Indication
    • Field Detail

      • Log

        public static final org.slf4j.Logger Log
      • ENABLED

        public static SystemProperty<Boolean> ENABLED
        Controls if Client State Indication functionality is made available to clients.

        public static SystemProperty<Boolean> DELAY_ENABLED
        Determines if 'unimportant' stanzas are delayed for a client that is inactive.

        public static SystemProperty<Duration> DELAY_MAX_DURATION
        Determines the maximum duration of stanzas being delayed for a client that is inactive.

        public static SystemProperty<Integer> DELAY_QUEUE_CAPACITY
        Determines the maximum length of the queue that holds delayed stanzas.
    • Method Detail

      • process

        public void process​(@Nonnull
                            org.dom4j.Element nonza)
        Processes a CSI nonza.
        nonza - The CSI nonza to be processed.
      • activate

        public void activate()
        Switch to the client state of 'active'.
      • deactivate

        public void deactivate()
        Switch to the client state of 'inactive'.
      • isActive

        public boolean isActive()
        Returns the client state for the session that is being tracked by this instance, either 'true' for 'active', or 'false' for 'inactive'
        a client state indication
      • getDelayQueueSize

        public int getDelayQueueSize()
        Returns the number of stanzas that are currently in the delay queue.
        the number of delayed stanzas.
      • queueOrPush

        public List<org.xmpp.packet.Packet> queueOrPush​(@Nonnull
                                                        org.xmpp.packet.Packet packet)
        Queues an unimportant stanza for later delivery, or returns the entire queue (including the argument) to be sent to the client.
        packet - the stanza to process.
        stanzas to be delivered to the client (possibly empty).
      • isStreamManagementNonza

        public static boolean isStreamManagementNonza​(@Nullable
                                                      org.dom4j.Element fragment)
        Checks if an XML fragment is recognized as a CSI nonza
        fragment - the XML to evaluate
        true if the XML is recognized as a CSI nonza, otherwise false.