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:
name The resource name
presence The resource presence
capability The resource capability
prio The resource priority
virtual ~JIDResource (  )  [inline, virtual]

Destructor


Member Function Documentation

void addTo ( XMLElement element,
bool  addInfo = true 
)

Add capabilities to a presence element

Parameters:
element The target presence element
addInfo True 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:
element A 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:
element The XML element
Returns:
The text or 0
static const char* getStatus ( XMLElement element  )  [static]

Get the 'show' child of a presence element

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

Check if the resource has the required capability

Parameters:
capability The 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
void priority ( int  value  )  [inline]

Set the priority of this resource

Parameters:
value The new priority of this resource
int priority (  )  [inline]

Get the priority of this resource

Returns:
The priority of this resource
void setName ( const char *  name  )  [inline]

Set the resource name

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

Set the presence information

Parameters:
value True if available, False if not
Returns:
True if presence changed
void show ( Show  s  )  [inline]

Set the show attribute

Parameters:
s The new show attribute
Show show (  )  const [inline]

Get the show attribute as enumeration

Returns:
The show attribute as enumeration
static const char* showText ( Show  show  )  [inline, static]

Get the text from a show type

Parameters:
show The 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:
text The text to check
Returns:
Show type as enumeration

References TelEngine::lookup().

void status ( const char *  s  )  [inline]

Set the status of this resource

Parameters:
s The 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:
Generated on Thu Apr 8 18:19:43 2010 for Yate by  doxygen 1.6.3