public class LastActivityManager extends Object
LastActivity (XEP-0012) based on the sending JID's type allows for retrieval of:
Connection con = new XMPPConnection("jabber.org"); con.login("john", "doe"); LastActivity activity = LastActivity.getLastActivity(con, "xray@jabber.org/Smack");To get the lapsed time since the last user logout is the same as above but with out the resource:
LastActivity activity = LastActivity.getLastActivity(con, "xray@jabber.org");To get the uptime of a host, you simple send the LastActivity packet to it, as in the following code example:
LastActivity activity = LastActivity.getLastActivity(con, "jabber.org");
Modifier and Type | Method and Description |
---|---|
static LastActivity |
getLastActivity(Connection con,
String jid)
Returns the last activity of a particular jid.
|
static boolean |
isLastActivitySupported(Connection connection,
String jid)
Returns true if Last Activity (XEP-0012) is supported by a given JID
|
public static LastActivity getLastActivity(Connection con, String jid) throws XMPPException
con
- the current Connection.jid
- the JID of the user.XMPPException
- thrown if a server error has occured.public static boolean isLastActivitySupported(Connection connection, String jid)
connection
- the connection to be usedjid
- a JID to be tested for Last Activity supportCopyright © 2003-2007 Jive Software.