Smack

org.jivesoftware.smackx.packet
Class LastActivity

java.lang.Object
  extended by org.jivesoftware.smack.packet.Packet
      extended by org.jivesoftware.smack.packet.IQ
          extended by 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 (XEP-0012) allows for retrieval of how long a particular user has been idle and the message the specified when doing so. Use LastActivityManager to get the last activity of a user.

Author:
Derek DeMoro

Nested Class Summary
static class LastActivity.Provider
          The IQ Provider for LastActivity.
 
Nested classes/interfaces inherited from class org.jivesoftware.smack.packet.IQ
IQ.Type
 
Field Summary
 long lastActivity
           
 java.lang.String message
           
static java.lang.String NAMESPACE
           
 
Fields inherited from class org.jivesoftware.smack.packet.Packet
DEFAULT_LANGUAGE, ID_NOT_AVAILABLE
 
Constructor Summary
LastActivity()
           
 
Method Summary
 java.lang.String getChildElementXML()
          Returns the sub-element XML section of the IQ packet, or null if there isn't one.
 long getIdleTime()
          Returns number of seconds that have passed since the user last logged out.
static LastActivity getLastActivity(Connection con, java.lang.String jid)
          Deprecated. This method only retreives the lapsed time since the last logout of a particular jid. Replaced by getLastActivity
 java.lang.String getStatusMessage()
          Returns the status message of the last unavailable presence received from the user.
 void setLastActivity(long lastActivity)
           
 
Methods inherited from class org.jivesoftware.smack.packet.IQ
createErrorResponse, createResultIQ, getType, setType, toXML
 
Methods inherited from class org.jivesoftware.smack.packet.Packet
addExtension, addExtensions, deleteProperty, equals, getDefaultLanguage, getError, getExtension, getExtension, getExtensions, getExtensionsXML, getFrom, getPacketID, getProperty, getPropertyNames, getTo, getXmlns, hashCode, nextID, removeExtension, setDefaultXmlns, setError, setFrom, setPacketID, setProperty, setTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAMESPACE

public static final java.lang.String NAMESPACE
See Also:
Constant Field Values

lastActivity

public long lastActivity

message

public java.lang.String message
Constructor Detail

LastActivity

public LastActivity()
Method Detail

getChildElementXML

public java.lang.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.

setLastActivity

public void setLastActivity(long lastActivity)

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 java.lang.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(Connection con,
                                           java.lang.String jid)
                                    throws XMPPException
Deprecated. This method only retreives the lapsed time since the last logout of a particular jid. Replaced by getLastActivity

Retrieve the last activity of a particular jid.

Parameters:
con - the current Connection.
jid - the JID of the user.
Returns:
the LastActivity packet of the jid.
Throws:
XMPPException - thrown if a server error has occured.

Smack

Copyright © 2003-2007 Jive Software.