public final class Idle
extends java.lang.Object
The implementation of the <idle/>
element in the urn:xmpp:idle:1
namespace.
It also provides a convenient method, which gets the idle time from a presence with respect to XEP-0319: Last User Interaction in Presence and the superseded XEP-0256: Last Activity in Presence.
presence.addExtension(Idle.since(OffsetDateTime.now()));
The following method takes the very similar XEP-0256: Last Activity in Presence extension into account as well. Delayed Delivery information on the presence is respected, too.
Instant idleSince = Idle.timeFromPresence(presence);
This class is immutable.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAMESPACE
urn:xmpp:idle:1
|
Modifier and Type | Method and Description |
---|---|
java.time.OffsetDateTime |
getSince()
Gets the date/time since the entity is idle.
|
static Idle |
since(java.time.OffsetDateTime since)
Creates an idle element with the date since when the user is idle.
|
static java.time.Instant |
timeFromPresence(Presence presence)
Extracts the idle time from a presence.
|
java.lang.String |
toString() |
public static final java.lang.String NAMESPACE
urn:xmpp:idle:1
public static Idle since(java.time.OffsetDateTime since)
Creates an idle element with the date since when the user is idle.
since
- The date.public static java.time.Instant timeFromPresence(Presence presence)
Extracts the idle time from a presence.
This methods first checks for a XEP-0319: Last User Interaction in Presence extension and uses XEP-0256: Last Activity in Presence semantics as fallback to determine the idle time.
Delayed delivery information is respected.
presence
- The presence.public final java.time.OffsetDateTime getSince()
Gets the date/time since the entity is idle.
public final java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2014–2019 XMPP.rocks. All rights reserved.