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)
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)
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 
) [inline]

Constructor. Set data members

Parameters:
name The resource name
presence The resource presence
capability The resource capability

virtual ~JIDResource (  )  [inline, virtual]

Destructor


Member Function Documentation

const String& name (  )  const [inline]

Get the resource name

Returns:
The resource name

void setName ( const char *  name  )  [inline]

Set the resource name

Parameters:
name The new name of the resource

Presence presence (  )  const [inline]

Get the presence attribute

Returns:
The presence attribute

bool available (  )  const [inline]

Check if the resource is available

Returns:
True if the resource is available

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:
s The new show attribute

const String& status (  )  const [inline]

Get the status of this resource

Returns:
The status of this resource

void status ( const char *  s  )  [inline]

Set the status of this resource

Parameters:
s The new status of this resource

ObjList* infoXml (  )  [inline]

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

Returns:
The info list

bool setPresence ( bool  value  ) 

Set the presence information

Parameters:
value True if available, False if not
Returns:
True if presence changed

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

bool fromXML ( XMLElement element  ) 

Update resource from a presence element

Parameters:
element A presence element
Returns:
True if presence or capability changed changed

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

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

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().

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().


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

Generated on Mon Aug 11 16:18:53 2008 for Yate by  doxygen 1.5.6