ClientContact Class Reference

A client contact. More...

#include <yatecbase.h>

Inheritance diagram for ClientContact:

RefObject GenObject

List of all members.

Public Member Functions

 ClientContact (ClientAccount *owner, const char *id, const char *name=0, bool chat=false)
 ClientContact (ClientAccount *owner, NamedList &params, bool chat)
ClientAccountaccount ()
const URIuri () const
ObjListresources ()
ObjListgroups ()
virtual const StringtoString () const
void buildContactId (String &dest)
bool isChatWnd (Window *wnd)
bool hasChat ()
bool isChatVisible ()
bool showChat (bool active)
void createChatWindow (bool force=false, const char *name="chat")
void destroyChatWindow ()
virtual StringfindGroup (const String &group)
virtual bool appendGroup (const String &group)
virtual bool removeGroup (const String &group)
virtual ClientResourcefindResource (const String &id, bool ref=false)
virtual ClientResourcefindAudioResource (bool ref=false)
virtual ClientResourceappendResource (const String &id)
virtual bool removeResource (const String &id)

Static Public Member Functions

static bool isChatWndPrefix (Window *wnd)
static void buildContactId (String &dest, const String &account, const String &contact)
static void splitContactId (const String &src, String &account, String &contact)

Public Attributes

String m_name
String m_subscription

Static Public Attributes

static String s_chatPrefix

Protected Member Functions

virtual void destroyed ()

Protected Attributes

ClientAccountm_owner
String m_id
URI m_uri
ObjList m_resources
ObjList m_groups

Friends

class ClientAccount


Detailed Description

A client contact.

A client contact The contact is using the owner's mutex to lock it's operations


Constructor & Destructor Documentation

ClientContact ( ClientAccount owner,
const char *  id,
const char *  name = 0,
bool  chat = false 
)

Constructor. Append itself to the owner's list

Parameters:
owner The contact's owner
id The contact's id
name Optional display name. Defaults to the id's value if 0
chat True to create the chat window

ClientContact ( ClientAccount owner,
NamedList params,
bool  chat 
)

Constructor. Build a contact from a list of parameters. . Append itself to the owner's list

Parameters:
owner The contact's owner
params The list of parameters used to build this contact
chat True to create the chat window


Member Function Documentation

ClientAccount* account (  )  [inline]

Get this contact's account

Returns:
This contact's account

virtual bool appendGroup ( const String group  )  [virtual]

Append a group to this contact

Parameters:
group Group's name
Returns:
False if the group already exists

virtual ClientResource* appendResource ( const String id  )  [virtual]

Append a resource having a given id

Parameters:
id The id of the desired resource
Returns:
ClientResource pointer or 0 if a resource with the given name already exists

static void buildContactId ( String dest,
const String account,
const String contact 
) [inline, static]

Build a contact id to be used in UI

Parameters:
dest Destination string
account Account owning the contact
contact The contact's id

References String::toLower().

void buildContactId ( String dest  )  [inline]

Build a contact id to be used in UI

Parameters:
dest Destination string

References ClientContact::buildContactId(), String::empty(), and String::toString().

Referenced by ClientContact::buildContactId().

void createChatWindow ( bool  force = false,
const char *  name = "chat" 
)

Create the chat window

Parameters:
force True to destroy the current one if any
name The window's name

void destroyChatWindow (  )  [inline]

Close (desrtoy) the chat window

virtual void destroyed (  )  [protected, virtual]

Pre-destruction notification, called just before the object is deleted. Unlike in the destructor it is safe to call virtual methods here. Reimplementing this method allows to perform any object cleanups.

Reimplemented from RefObject.

virtual ClientResource* findAudioResource ( bool  ref = false  )  [virtual]

Get the first resource with audio capability

Parameters:
ref True to obtain a referenced pointer
Returns:
ClientResource pointer or 0 if not found

virtual String* findGroup ( const String group  )  [virtual]

Find a group this contact might belong to

Parameters:
group The name of the group to find
Returns:
String pointer or 0 if not found

virtual ClientResource* findResource ( const String id,
bool  ref = false 
) [virtual]

Find a resource having a given id

Parameters:
id The id of the desired resource
ref True to obtain a referenced pointer
Returns:
ClientResource pointer or 0 if not found

ObjList& groups (  )  [inline]

Get the group list of this contact

Returns:
The group list of this contact

bool hasChat (  )  [inline]

Check if this contact has a chat window

Returns:
True if this contact has a chat window

bool isChatVisible (  )  [inline]

Check if this contact's chat window is visible

Returns:
True if this contact's chat window is visible

bool isChatWnd ( Window wnd  )  [inline]

Check if a window is this contact's chat

Parameters:
wnd The window to check
Returns:
True if the given window is this contact's chat

References Window::toString().

static bool isChatWndPrefix ( Window wnd  )  [inline, static]

Check if a window is a chat one

Parameters:
wnd The window to check
Returns:
True if the given window's name starts with the chat refix

References String::startsWith(), and Window::toString().

virtual bool removeGroup ( const String group  )  [virtual]

Remove a contact's group

Parameters:
group Group's name
Returns:
False if the group was not found

virtual bool removeResource ( const String id  )  [virtual]

Remove a resource having a given id

Parameters:
id The id of the desired resource
Returns:
True if the resource was removed

ObjList& resources (  )  [inline]

Get the resource list of this contact

Returns:
The resource list of this contact

bool showChat ( bool  active  )  [inline]

Show or hide this contact's chat window

Parameters:
active The chat window's visibility flag
Returns:
True on success

static void splitContactId ( const String src,
String account,
String contact 
) [inline, static]

Split a contact id

Parameters:
src Source string
account Account name
contact Contact's name

References String::find(), and String::substr().

virtual const String& toString (  )  const [inline, virtual]

Get a string representation of this object

Returns:
The contact's id

Reimplemented from GenObject.

const URI& uri (  )  const [inline]

Get this contact's URI

Returns:
This contact's URI


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

Generated on Sun Dec 7 21:36:12 2008 for Yate by  doxygen 1.5.7.1