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

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)
WindowgetChatWnd () const
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:
ownerThe contact's owner
idThe contact's id
nameOptional display name. Defaults to the id's value if 0
chatTrue 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:
ownerThe contact's owner
paramsThe list of parameters used to build this contact
chatTrue 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:
groupGroup's name
Returns:
False if the group already exists
virtual ClientResource* appendResource ( const String id) [virtual]

Append a resource having a given id

Parameters:
idThe 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:
destDestination string
accountAccount owning the contact
contactThe contact's id

References String::toLower().

void buildContactId ( String dest) [inline]

Build a contact id to be used in UI

Parameters:
destDestination 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:
forceTrue to destroy the current one if any
nameThe 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:
refTrue 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:
groupThe 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:
idThe id of the desired resource
refTrue to obtain a referenced pointer
Returns:
ClientResource pointer or 0 if not found
Window* getChatWnd ( ) const [inline]

Get the chat window

Returns:
Valid Window pointer or 0
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:
wndThe 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:
wndThe 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:
groupGroup'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:
idThe 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:
activeThe 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:
srcSource string
accountAccount name
contactContact'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: