org.jivesoftware.smackx.packet
Class LastActivity
java.lang.Object
org.jivesoftware.smack.packet.Packet
org.jivesoftware.smack.packet.IQ
org.jivesoftware.smackx.packet.LastActivity
public class LastActivity
- extends IQ
A last activity IQ for retrieving information about the last activity associated with a Jabber ID.
LastActivity (JEP-012) allows for retrieval of how long a particular user has been idle and the
message the specified when doing so.
To get the last activity of a user, simple send the LastActivity packet to them, as in the
following code example:
XMPPConnection con = new XMPPConnection("jabber.org");
con.login("john", "doe");
LastActivity activity = LastActivity.getLastActivity(con, "xray@jabber.org");
- Author:
- Derek DeMoro
Nested classes/interfaces inherited from class org.jivesoftware.smack.packet.IQ |
IQ.Type |
Methods inherited from class org.jivesoftware.smack.packet.Packet |
addExtension, deleteProperty, getError, getExtension, getExtensions, getExtensionsXML, getFrom, getPacketID, getProperty, getPropertyNames, getTo, removeExtension, setError, setFrom, setPacketID, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setTo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
lastActivity
public long lastActivity
message
public String message
LastActivity
public LastActivity()
getChildElementXML
public String getChildElementXML()
- Description copied from class:
IQ
- Returns the sub-element XML section of the IQ packet, or null if there
isn't one. Packet extensions must be included, if any are defined.
Extensions of this class must override this method.
- Specified by:
getChildElementXML
in class IQ
- Returns:
- the child element section of the IQ XML.
getIdleTime
public long getIdleTime()
- Returns number of seconds that have passed since the user last logged out.
If the user is offline, 0 will be returned.
- Returns:
- the number of seconds that have passed since the user last logged out.
getStatusMessage
public String getStatusMessage()
- Returns the status message of the last unavailable presence received from the user.
- Returns:
- the status message of the last unavailable presence received from the user
getLastActivity
public static LastActivity getLastActivity(XMPPConnection con,
String jid)
throws XMPPException
- Retrieve the last activity of a particular jid.
- Parameters:
con
- the current XMPPConnection.jid
- the JID of the user.
- Returns:
- the LastActivity packet of the jid.
- Throws:
XMPPException
- thrown if a server error has occured.
Copyright © 2003 Jive Software.