Yate
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Attributes

JIDResource Class Reference

A JID resource. More...

#include <yatejabber.h>

Inheritance diagram for JIDResource:
RefObject GenObject

List of all members.

Public Types

enum  Capability { CapChat = 1, CapAudio = 2 }
enum  Presence { Unknown = 0, Available = 1, Unavailable = 2 }
enum  Show {
  ShowAway, ShowChat, ShowDND, ShowXA,
  ShowNone
}

Public Member Functions

 JIDResource (const char *name, Presence presence=Unknown, u_int32_t capability=CapChat, int prio=0)
virtual ~JIDResource ()
const Stringname () const
void setName (const char *name)
Presence presence () const
bool available () const
Show show () const
void show (Show s)
const Stringstatus () const
void status (const char *s)
int priority ()
void priority (int value)
JIDFeatureListfeatures ()
ObjListinfoXml ()
bool setPresence (bool value)
bool hasCap (Capability capability) const
bool fromXML (XMLElement *element)
void addTo (XMLElement *element, bool addInfo=true)

Static Public Member Functions

static const char * getShow (XMLElement *element)
static const char * getStatus (XMLElement *element)
static Show showType (const char *text)
static const char * showText (Show show)

Static Protected Attributes

static TokenDict s_show []

Detailed Description

A JID resource.

This class holds a JID resource (name,presence,capabilities)


Member Enumeration Documentation

enum Capability

Resource capabilities enumeration.

enum Presence

Resource presence enumeration

enum Show

Values of the 'show' child of a presence element


Constructor & Destructor Documentation

JIDResource ( const char *  name,
Presence  presence = Unknown,
u_int32_t  capability = CapChat,
int  prio = 0 
) [inline]

Constructor. Set data members

Parameters:
nameThe resource name
presenceThe resource presence
capabilityThe resource capability
prioThe resource priority
virtual ~JIDResource ( ) [inline, virtual]

Destructor


Member Function Documentation

void addTo ( XMLElement element,
bool  addInfo = true 
)

Add capabilities to a presence element

Parameters:
elementThe target presence element
addInfoTrue to add the elements from info list
bool available ( ) const [inline]

Check if the resource is available

Returns:
True if the resource is available
JIDFeatureList& features ( ) [inline]

Get the list of resource features

Returns:
The resource features
bool fromXML ( XMLElement element)

Update resource from a presence element

Parameters:
elementA presence element
Returns:
True if presence or capability changed changed
static const char* getShow ( XMLElement element) [static]

Get the 'show' child of a presence element

Parameters:
elementThe XML element
Returns:
The text or 0
static const char* getStatus ( XMLElement element) [static]

Get the 'show' child of a presence element

Parameters:
elementThe XML element
Returns:
The text or 0
bool hasCap ( Capability  capability) const [inline]

Check if the resource has the required capability

Parameters:
capabilityThe required capability
Returns:
True if the resource has the required capability
ObjList* infoXml ( ) [inline]

Get the list containing XML elements with additional data describing this resource

Returns:
The info list
const String& name ( ) const [inline]

Get the resource name

Returns:
The resource name
Presence presence ( ) const [inline]

Get the presence attribute

Returns:
The presence attribute
int priority ( ) [inline]

Get the priority of this resource

Returns:
The priority of this resource
void priority ( int  value) [inline]

Set the priority of this resource

Parameters:
valueThe new priority of this resource
void setName ( const char *  name) [inline]

Set the resource name

Parameters:
nameThe new name of the resource
bool setPresence ( bool  value)

Set the presence information

Parameters:
valueTrue if available, False if not
Returns:
True if presence changed
Show show ( ) const [inline]

Get the show attribute as enumeration

Returns:
The show attribute as enumeration
void show ( Show  s) [inline]

Set the show attribute

Parameters:
sThe new show attribute
static const char* showText ( Show  show) [inline, static]

Get the text from a show type

Parameters:
showThe type to get text for
Returns:
The associated text or 0

References TelEngine::lookup().

static Show showType ( const char *  text) [inline, static]

Get the type of a 'show' element as enumeration

Parameters:
textThe text to check
Returns:
Show type as enumeration

References TelEngine::lookup().

void status ( const char *  s) [inline]

Set the status of this resource

Parameters:
sThe new status of this resource
const String& status ( ) const [inline]

Get the status of this resource

Returns:
The status of this resource

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