Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

jabberoo::Presence Class Reference

A Jabber Presence Packet. More...

#include <presence.hh>

Inheritance diagram for jabberoo::Presence:

jabberoo::Packet List of all members.

Public Types

enum  Type {
  ptSubRequest, ptUnsubRequest, ptSubscribed, ptUnsubscribed,
  ptAvailable, ptUnavailable, ptError, ptInvisible
}
 Presence type of the Packet. More...

enum  Show {
  stInvalid, stOffline, stOnline, stChat,
  stAway, stXA, stDND
}
 How the Presence should be displayed. More...


Public Member Functions

 Presence (const judo::Element &t)
 Construct a Presence Packet based upon the given judo::Element.

 Presence (const std::string &jid, Type ptype, Show stype=stInvalid, const std::string &status="", const std::string &priority="0")
 Construct a Presence Packet based upon given values.

void setType (Presence::Type ptype)
 Set the presence type.

void setStatus (const std::string &status)
 Set the presence status message.

void setShow (Presence::Show stype)
 Set the presence show.

void setPriority (const std::string &priority)
 Set the presence priority.

Type getType () const
 Get the presence type.

Show getShow () const
 Get the presence show.

const std::string getStatus () const
 Get the presence status message.

const std::string getShow_str () const
 Get the Presence::Show as a string.

int getPriority () const
 Get the priority of the presence.


Detailed Description

A Jabber Presence Packet.

This class implements most of the methods needed to deal with a Jabber Presence Packet.

See also:
jabberoo::Packet

Definition at line 45 of file presence.hh.


Member Enumeration Documentation

enum jabberoo::Presence::Show
 

How the Presence should be displayed.

In addition to simply being available/unavailable, show hints at how a user's presence should be displayed in clients.

Enumeration values:
stInvalid  Not a valid show type.
stOffline  Show user as offline.
stOnline  Show user as online.
stChat  Show user as wanting to chat.
stAway  Show user as away.
stXA  Show user as extended away.
stDND  Show user as Do Not Disturb.

Definition at line 68 of file presence.hh.

enum jabberoo::Presence::Type
 

Presence type of the Packet.

Enumeration values:
ptSubRequest  A subscription request.
ptUnsubRequest  An unsubscription request.
ptSubscribed  Subscription confirmed/allowed/approved.
ptUnsubscribed  Subscription revoked/denied.
ptAvailable  Available presence (standard online presence).
ptUnavailable  Unavailable presence (offline).
ptError  Error (offline).
ptInvisible  Invisible presence, others see you as offline.

Definition at line 52 of file presence.hh.


Constructor & Destructor Documentation

jabberoo::Presence::Presence const judo::Element   t
 

Construct a Presence Packet based upon the given judo::Element.

See also:
judo::Element

jabberoo::Packet

Parameters:
t A judo::Element which should have a presence base element

Definition at line 36 of file jabberoo-presence.cpp.

jabberoo::Presence::Presence const std::string &    jid,
Type    ptype,
Show    stype = stInvalid,
const std::string &    status = "",
const std::string &    priority = "0"
 

Construct a Presence Packet based upon given values.

See also:
jabberoo::Packet
Parameters:
jid The JabberID to send this presence to. An empty string sends to everyone who has the proper subscription.
ptype The Presence::Type of presence to send.
stype The Presence::Show for the presence, Presence::stInvalid leaves it blank.
status The status message for the presence. Can be an empty string.
priority The priority of this presence. Should be a string of an int which is 0 or greater. Empty string sets it to 0.

Definition at line 45 of file jabberoo-presence.cpp.

References setPriority(), setShow(), setStatus(), jabberoo::Packet::setTo(), and setType().


Member Function Documentation

int jabberoo::Presence::getPriority   const
 

Get the priority of the presence.

The priority determines which resource messages should default to sending to if the sender has logged in multiple times. If two resources have the same priority, the most recently logged in resource is the default.

Returns:
Priority as an int, 0 or greater. 0 if nonexistent.

Definition at line 110 of file jabberoo-presence.cpp.

References judo::Element::getChildCData().

Referenced by jabberoo::PresenceDB::insert().

Presence::Show jabberoo::Presence::getShow   const
 

Get the presence show.

See also:
Presence::Show
Returns:
The Presence::Show of the Presence Packet.

Definition at line 100 of file jabberoo-presence.cpp.

const std::string jabberoo::Presence::getShow_str   const
 

Get the Presence::Show as a string.

See also:
Presence::Show
Returns:
The string version of the Presence::Show of the Presence Packet.

Definition at line 105 of file jabberoo-presence.cpp.

const std::string jabberoo::Presence::getStatus   const
 

Get the presence status message.

In subscription request Presence Packets, the status message is the request reason.

Returns:
The status message in the Presence Packet.

Definition at line 92 of file jabberoo-presence.cpp.

References judo::Element::getChildCData().

Presence::Type jabberoo::Presence::getType   const
 

Get the presence type.

See also:
Presence::Type
Returns:
The Presence::Type of the Presence Packet.

Definition at line 87 of file jabberoo-presence.cpp.

Referenced by jabberoo::PresenceDB::insert().

void jabberoo::Presence::setPriority const std::string &    priority
 

Set the presence priority.

Parameters:
priority The priority of this presence. Should be a string of an int.

Definition at line 78 of file jabberoo-presence.cpp.

References judo::Element::addElement().

Referenced by Presence().

void jabberoo::Presence::setShow Presence::Show    stype
 

Set the presence show.

See also:
Presence::Show
Parameters:
stype The Presence::Show for the presence.

Definition at line 69 of file jabberoo-presence.cpp.

References judo::Element::addElement(), and stOnline.

Referenced by Presence().

void jabberoo::Presence::setStatus const std::string &    status
 

Set the presence status message.

Parameters:
status The status message for the presence. Can be an empty string.

Definition at line 63 of file jabberoo-presence.cpp.

References judo::Element::addElement().

Referenced by Presence().

void jabberoo::Presence::setType Presence::Type    ptype
 

Set the presence type.

See also:
Presence::Type
Parameters:
ptype The Presence::Type of presence to send.

Definition at line 56 of file jabberoo-presence.cpp.

References judo::Element::putAttrib().

Referenced by Presence().


The documentation for this class was generated from the following files:
Generated on Thu Jul 24 13:31:53 2003 for jabberoo by doxygen1.3-rc3