| java.lang.Object org.xmpp.packet.Packet org.xmpp.packet.Presence
All known Subclasses: org.xmpp.muc.LeaveRoom, org.xmpp.muc.JoinRoom,
Presence | public class Presence extends Packet (Code) | | Presence packet. Presence packets are used to express an entity's current
network availability and to notify other entities of that availability.
Presence packets are also used to negotiate and manage subscriptions to the
presence of other entities.
A presence optionally has a
Type .
author: Matt Tucker |
Inner Class :public enum Type | |
Inner Class :public enum Show | |
Constructor Summary | |
public | Presence() Constructs a new Presence. | public | Presence(Presence.Type type) Constructs a new Presence with the specified type. | public | Presence(Element element) Constructs a new Presence using an existing Element. | public | Presence(Element element, boolean skipValidation) Constructs a new Presence using an existing Element. |
Method Summary | |
public Element | addChildElement(String name, String namespace) Adds a new child element to this packet with the given name and
namespace. | public Presence | createCopy() Returns a deep copy of this Presence. | public Element | getChildElement(String name, String namespace) Returns the first child element of this packet that matches the
given name and namespace. | public int | getPriority() Returns the priority. | public Show | getShow() Returns the presence "show" value, which specifies a particular availability
status. | public String | getStatus() Returns the status of this presence packet, a natural-language description
of availability status. | public Type | getType() Returns the type of this presence. | public boolean | isAvailable() Returns true if the presence type is "available". | public void | setPriority(int priority) Sets the priority. | public void | setShow(Show show) Sets the presence "show" value, which specifies a particular availability
status. | public void | setStatus(String status) Sets the status of this presence packet, a natural-language description
of availability status. | public void | setType(Type type) Sets the type of this presence. |
Presence | public Presence()(Code) | | Constructs a new Presence.
|
Presence | public Presence(Presence.Type type)(Code) | | Constructs a new Presence with the specified type.
Parameters: type - the presence type. |
Presence | public Presence(Element element)(Code) | | Constructs a new Presence using an existing Element. This is useful
for parsing incoming presence Elements into Presence objects.
Parameters: element - the presence Element. |
Presence | public Presence(Element element, boolean skipValidation)(Code) | | Constructs a new Presence using an existing Element. This is useful
for parsing incoming Presence Elements into Presence objects. Stringprep validation
on the TO address can be disabled. The FROM address will not be validated since the
server is the one that sets that value.
Parameters: element - the Presence Element. Parameters: skipValidation - true if stringprep should not be applied to the TO address. |
addChildElement | public Element addChildElement(String name, String namespace)(Code) | | Adds a new child element to this packet with the given name and
namespace. The newly created Element is returned. This is a
convenience method to avoid manipulating this underlying packet's
Element instance directly.
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 Jabber Enhancement Proposals
(JEPs).
Parameters: name - the element name. Parameters: namespace - the element namespace. the newly created child element. |
createCopy | public Presence createCopy()(Code) | | Returns a deep copy of this Presence.
a deep copy of this Presence. |
getChildElement | public Element getChildElement(String name, String namespace)(Code) | | Returns the first child element of this packet that matches the
given name and namespace. If no matching element is found,
null will be returned. This is a convenience method to avoid
manipulating this underlying packet's Element instance directly.
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 Jabber Enhancement Proposals
(JEPs).
Parameters: name - the element name. Parameters: namespace - the element namespace. the first matching child element, or null if thereis no matching child element. |
getPriority | public int getPriority()(Code) | | Returns the priority. The valid priority range is -128 through 128.
If no priority element exists in the packet, this method will return
the default value of 0.
the priority. |
getShow | public Show getShow()(Code) | | Returns the presence "show" value, which specifies a particular availability
status. If the <show> element is not present, this method will return
null. The show value can only be set if the presence type is "avaialble".
A null show value is used to represent "available", which is the
default.
the presence show value.. See Also: Show |
getStatus | public String getStatus()(Code) | | Returns the status of this presence packet, a natural-language description
of availability status.
the status. |
getType | public Type getType()(Code) | | Returns the type of this presence. If the presence is "available", the
type will be null (in XMPP, no value for the type attribute is
defined as available).
the presence type or null if "available". See Also: Type |
isAvailable | public boolean isAvailable()(Code) | | Returns true if the presence type is "available". This is a
convenience method that is equivalent to:
getType() == null
|
setPriority | public void setPriority(int priority)(Code) | | Sets the priority. The valid priority range is -128 through 128.
Parameters: priority - the priority. throws: IllegalArgumentException - if the priority is less than -128 or greaterthan 128. |
setShow | public void setShow(Show show)(Code) | | Sets the presence "show" value, which specifies a particular availability
status. The show value can only be set if the presence type is "available".
A null show value is used to represent "available", which is the
default.
Parameters: show - the presence show value. throws: IllegalArgumentException - if the presence type is not available. See Also: Show |
setStatus | public void setStatus(String status)(Code) | | Sets the status of this presence packet, a natural-language description
of availability status.
Parameters: status - the status. |
setType | public void setType(Type type)(Code) | | Sets the type of this presence.
Parameters: type - the presence type. See Also: Type |
|
|