@NotThreadSafe public class Presence extends Packet
A presence optionally has a Presence.Type.
| Modifier and Type | Class and Description |
|---|---|
static class |
Presence.Show
Represents the presence "show" value.
|
static class |
Presence.Type
Represents the type of a presence packet.
|
docFactory, element, fromJID, toJID| Constructor and Description |
|---|
Presence()
Constructs a new Presence.
|
Presence(org.dom4j.Element element)
Constructs a new Presence using an existing Element.
|
Presence(org.dom4j.Element element,
boolean skipValidation)
Constructs a new Presence using an existing Element.
|
Presence(Presence.Type type)
Constructs a new Presence with the specified type.
|
| Modifier and Type | Method and Description |
|---|---|
org.dom4j.Element |
addChildElement(String name,
String namespace)
Adds a new child element to this packet with the given name and
namespace.
|
Presence |
createCopy()
Returns a deep copy of this Presence.
|
org.dom4j.Element |
getChildElement(String name,
String namespace)
Returns the first child element of this packet that matches the
given name and namespace.
|
int |
getPriority()
Returns the priority.
|
Presence.Show |
getShow()
Returns the presence "show" value, which specifies a particular availability
status.
|
String |
getStatus()
Returns the status of this presence packet, a natural-language description
of availability status.
|
Presence.Type |
getType()
Returns the type of this presence.
|
boolean |
isAvailable()
Returns true if the presence type is "available".
|
void |
setPriority(int priority)
Sets the priority.
|
void |
setShow(Presence.Show show)
Sets the presence "show" value, which specifies a particular availability
status.
|
void |
setStatus(String status)
Sets the status of this presence packet, a natural-language description
of availability status.
|
void |
setType(Presence.Type type)
Sets the type of this presence.
|
addExtension, deleteExtension, getElement, getError, getExtension, getFrom, getID, getTo, setError, setError, setFrom, setFrom, setID, setTo, setTo, toString, toXMLpublic Presence()
public Presence(Presence.Type type)
type - the presence type.public Presence(org.dom4j.Element element)
element - the presence Element.public Presence(org.dom4j.Element element,
boolean skipValidation)
element - the Presence Element.skipValidation - true if stringprep should not be applied to the TO address.public boolean isAvailable()
getType() == null
public Presence.Type getType()
Presence.Typepublic void setType(Presence.Type type)
type - the presence type.Presence.Typepublic Presence.Show getShow()
Presence.Showpublic void setShow(Presence.Show show)
show - the presence show value.IllegalArgumentException - if the presence type is not available.Presence.Showpublic String getStatus()
public void setStatus(String status)
status - the status.public int getPriority()
public void setPriority(int priority)
priority - the priority.IllegalArgumentException - if the priority is less than -128 or greater
than 128.public org.dom4j.Element getChildElement(String name, String namespace)
Child elements in extended namespaces are used to extend the features of XMPP. Examples include a "user is typing" indicator and invitations to group chat rooms. Although any valid XML can be included in a child element in an extended namespace, many common features have been standardized as XMPP Extension Protocols (XEPs).
name - the element name.namespace - the element namespace.public org.dom4j.Element addChildElement(String name, String namespace)
Child elements in extended namespaces are used to extend the features of XMPP. Examples include a "user is typing" indicator and invitations to group chat rooms. Although any valid XML can be included in a child element in an extended namespace, many common features have been standardized as XMPP Extension Protocols (XEPs).
name - the element name.namespace - the element namespace.public Presence createCopy()
createCopy in class PacketCopyright © 2009–2017 Ignite Realtime. All rights reserved.