public class Presence extends Packet
A number of attributes are optional:
Presence packets are used for two purposes. First, to notify the server of our the clients current presence status. Second, they are used to subscribe and unsubscribe users from the roster.
RosterPacket
Modifier and Type | Class and Description |
---|---|
static class |
Presence.Mode
A typsafe enum class to represent the presence mode.
|
static class |
Presence.Type
A typsafe enum class to represent the presecence type.
|
ID_NOT_AVAILABLE
Constructor and Description |
---|
Presence(Presence.Type type)
Creates a new presence update.
|
Presence(Presence.Type type,
java.lang.String status,
int priority,
Presence.Mode mode)
Creates a new presence update with a specified status, priority, and mode.
|
Modifier and Type | Method and Description |
---|---|
Presence.Mode |
getMode()
Returns the mode of the presence update.
|
int |
getPriority()
Returns the priority of the presence, or -1 if no priority has been set.
|
java.lang.String |
getStatus()
Returns the status message of the presence update, or null if there
is not a status.
|
Presence.Type |
getType()
Returns the type of this presence packet.
|
void |
setMode(Presence.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(Presence.Type type)
Sets the type of the presence packet.
|
java.lang.String |
toString() |
java.lang.String |
toXML()
Returns the packet as XML.
|
addExtension, deleteProperty, getError, getExtension, getExtensions, getExtensionsXML, getFrom, getPacketID, getProperty, getPropertyNames, getTo, removeExtension, setError, setFrom, setPacketID, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setTo
public Presence(Presence.Type type)
type
- the type.public Presence(Presence.Type type, java.lang.String status, int priority, Presence.Mode mode)
type
- the type.status
- a text message describing the presence update.priority
- the priority of this presence update.mode
- the mode type for this presence update.public Presence.Type getType()
public void setType(Presence.Type type)
type
- the type of the presence packet.public java.lang.String getStatus()
public void setStatus(java.lang.String status)
status
- the status message.public int getPriority()
public void setPriority(int priority)
priority
- the priority of the presence.java.lang.IllegalArgumentException
- if the priority is outside the valid range.public Presence.Mode getMode()
public void setMode(Presence.Mode mode)
mode
- the mode.public java.lang.String toXML()
Packet
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2003 Jive Software.