com.voiceclearly.api.chat
Class GooglePresence

java.lang.Object
  extended by Packet
      extended by com.voiceclearly.api.chat.GooglePresence

public class GooglePresence
extends Packet

Represents Google Talk presence packets.


Nested Class Summary
static class GooglePresence.Mode
          An enum to represent the presence mode.
static class GooglePresence.Type
          A enum to represent the presecence type.
 
Constructor Summary
GooglePresence(GooglePresence.Type type)
          Creates a presence update.
GooglePresence(GooglePresence.Type type, java.lang.String status, int priority, GooglePresence.Mode mode)
          Creates a presence update with type, status, priority, and mode.
 
Method Summary
 GooglePresence.Mode getMode()
          Returns the mode of the presence update
 int getPriority()
          Returns the priority of the presence
 java.lang.String getStatus()
          Returns the status message of the user
 GooglePresence.Type getType()
          Returns the type of this presence packet.
 boolean isAvailable()
          Returns true if the user is available (online) and false if the user is unavailable (offline)
 boolean isAway()
          Returns true if the presence type is available and the presence mode is away, extended away, or dnd (do not disturb).
 void setLanguage(java.lang.String language)
          Sets the xml:lang of this Presence.
 void setMode(GooglePresence.Mode mode)
          Sets the mode of the presence update.
 void setPriority(int priority)
          Sets the priority of the presence.
 void setStatus(java.lang.String status)
          Sets the status message of the presence update.
 void setType(GooglePresence.Type type)
          Sets the type of the presence packet.
 java.lang.String toString()
           
 java.lang.String toXML()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GooglePresence

public GooglePresence(GooglePresence.Type type)
Creates a presence update.

Parameters:
type - the type.

GooglePresence

public GooglePresence(GooglePresence.Type type,
                      java.lang.String status,
                      int priority,
                      GooglePresence.Mode mode)
Creates a presence update with type, status, priority, and mode.

Parameters:
type - the type.
status - a text message describing the presence update.
priority - the priority of this presence update.
mode - the mode
Method Detail

isAvailable

public boolean isAvailable()
Returns true if the user is available (online) and false if the user is unavailable (offline)

Returns:
true if the presence type is available.

isAway

public boolean isAway()
Returns true if the presence type is available and the presence mode is away, extended away, or dnd (do not disturb). False will be returned when the type or mode is any other value, including when the presence type is unavailable (offline).

Returns:
true if the presence type is available and the presence mode is away, or dnd.

getType

public GooglePresence.Type getType()
Returns the type of this presence packet.

Returns:
the type of the presence packet.

setType

public void setType(GooglePresence.Type type)
Sets the type of the presence packet.

Parameters:
type - the type of the presence packet.

getStatus

public java.lang.String getStatus()
Returns the status message of the user

Returns:
the status message.

setStatus

public void setStatus(java.lang.String status)
Sets the status message of the presence update.

Parameters:
status - the status message.

getPriority

public int getPriority()
Returns the priority of the presence

Returns:
the priority.

setPriority

public void setPriority(int priority)
Sets the priority of the presence. The valid range is between -128 and 128.

Parameters:
priority - the priority of the presence.
Throws:
java.lang.IllegalArgumentException - if the priority is outside the valid range.

getMode

public GooglePresence.Mode getMode()
Returns the mode of the presence update

Returns:
the mode.

setMode

public void setMode(GooglePresence.Mode mode)
Sets the mode of the presence update.

Parameters:
mode - the mode.

setLanguage

public void setLanguage(java.lang.String language)
Sets the xml:lang of this Presence.

Parameters:
language - the xml:lang of this Presence.

toXML

public java.lang.String toXML()

toString

public java.lang.String toString()
Returns: