gloox  1.0.1
Public Types | Public Member Functions | List of all members
Presence Class Reference

#include <presence.h>

Inheritance diagram for Presence:
Inheritance graph
[legend]

Public Types

enum  PresenceType {
  Available, Chat, Away, DND,
  XA, Unavailable, Probe, Error,
  Invalid
}

Public Member Functions

 Presence (PresenceType type, const JID &to, const std::string &status=EmptyString, int priority=0, const std::string &xmllang=EmptyString)
virtual ~Presence ()
PresenceType subtype () const
const Capabilitiescapabilities () const
PresenceType presence () const
void setPresence (PresenceType type)
const std::string status (const std::string &lang="default") const
void addStatus (const std::string &status, const std::string &lang=EmptyString)
void resetStatus ()
int priority () const
void setPriority (int priority)
virtual Tagtag () const
- Public Member Functions inherited from Stanza
virtual ~Stanza ()
void setFrom (const JID &from)
const JIDfrom () const
const JIDto () const
const std::string & id () const
const Errorerror () const
const std::string & xmlLang () const
void addExtension (const StanzaExtension *se)
const StanzaExtensionfindExtension (int type) const
template<class T >
const T * findExtension (int type) const
const StanzaExtensionListextensions () const
void removeExtensions ()

Additional Inherited Members

- Protected Member Functions inherited from Stanza
 Stanza (Tag *tag)
 Stanza (const JID &to)

Detailed Description

An abstraction of a presence stanza.

Author
Jakob Schroeter js@ca.nosp@m.maya.nosp@m..net
Since
1.0

Definition at line 32 of file presence.h.

Member Enumeration Documentation

Describes the different valid presence types.

Enumerator:
Available 

The entity is online.

Chat 

The entity is 'available for chat'.

Away 

The entity is away.

DND 

The entity is DND (Do Not Disturb).

XA 

The entity is XA (eXtended Away).

Unavailable 

The entity is offline.

Probe 

This is a presence probe.

Error 

This is a presence error.

Invalid 

The stanza is invalid.

Definition at line 42 of file presence.h.

Constructor & Destructor Documentation

Presence ( PresenceType  type,
const JID to,
const std::string &  status = EmptyString,
int  priority = 0,
const std::string &  xmllang = EmptyString 
)

Creates a Presence request.

Parameters
typeThe presence type.
toThe intended receiver. Use an empty JID to create a broadcast packet.
statusAn optional status message (e.g. "gone fishing").
priorityAn optional presence priority. Legal range is between -128 and +127. Defaults to 0.
xmllangAn optional xml:lang for the status message.

Definition at line 72 of file presence.cpp.

~Presence ( )
virtual

Destructor.

Definition at line 81 of file presence.cpp.

Member Function Documentation

void addStatus ( const std::string &  status,
const std::string &  lang = EmptyString 
)
inline

Adds a (possibly translated) status message.

Parameters
statusThe status message.
langThe language identifier for the desired language. It must conform to section 2.12 of the XML specification and RFC 3066.

Definition at line 117 of file presence.h.

const Capabilities * capabilities ( ) const

A convenience function returning the stanza's Capabilities, if any. May be 0.

Returns
A pointer to a Capabilities object, or 0.

Definition at line 103 of file presence.cpp.

PresenceType presence ( ) const
inline

Returns the presence's type.

Returns
The presence's type.

Definition at line 89 of file presence.h.

int priority ( ) const
inline

Returns the presence priority in the legal range: -128 to +127.

Returns
The priority information contained in the stanza, defaults to 0.

Definition at line 131 of file presence.h.

void resetStatus ( )

Resets the default status message as well as all language-specific ones.

Definition at line 86 of file presence.cpp.

void setPresence ( PresenceType  type)
inline

Sets the presence type.

Parameters
typeThe presence type.

Definition at line 95 of file presence.h.

void setPriority ( int  priority)

Sets the priority. Legal range: -128 to +127.

Parameters
priorityThe priority to set.

Definition at line 93 of file presence.cpp.

const std::string status ( const std::string &  lang = "default") const
inline

Returns the status text of a presence stanza for the given language if available. If the requested language is not available, the default status text (without a xml:lang attribute) will be returned.

Parameters
langThe language identifier for the desired language. It must conform to section 2.12 of the XML specification and RFC 3066. If empty, the default body will be returned, if any.
Returns
The status text set by the sender.

Definition at line 106 of file presence.h.

PresenceType subtype ( ) const
inline

Returns the presence's type.

Returns
The presence's type.

Definition at line 76 of file presence.h.

Tag * tag ( ) const
virtual

Creates a Tag representation of the Stanza. The Tag is completely independent of the Stanza and will not be updated when the Stanza is modified.

Returns
A pointer to a Tag representation. It is the job of the caller to delete the Tag.

Implements Stanza.

Definition at line 108 of file presence.cpp.


The documentation for this class was generated from the following files: