ClientAccount Class Reference

A client account. More...

#include <yatecbase.h>

Inheritance diagram for ClientAccount:

RefObject Mutex GenObject

List of all members.

Public Member Functions

 ClientAccount (const char *proto, const char *user, const char *host, bool startup)
 ClientAccount (const NamedList &params)
const URIuri () const
const URIid () const
ObjListcontacts ()
virtual const StringtoString () const
ClientResourceresource (bool ref=false)
void setResource (ClientResource *res=0)
virtual ClientContactfindContact (const String &id, bool ref=false)
virtual ClientContactfindContact (const String &id, const String &resid, bool ref=false)
virtual ClientContactappendContact (const String &id, const char *name)
virtual ClientContactappendContact (const NamedList &params)
virtual ClientContactremoveContact (const String &id, bool delObj=true)
virtual Messageuserlogin (bool login, const char *msg="user.login")

Static Public Member Functions

static void buildAccountId (URI &dest, const char *proto, const char *user, const char *host)

Public Attributes

String m_password
String m_server
int m_port
String m_options
bool m_startup
String m_outbound
int m_expires
bool m_connected

Protected Member Functions

virtual void destroyed ()
virtual void appendContact (ClientContact *contact)
void setIdUri (const char *proto, const char *user, const char *host)

Protected Attributes

URI m_id
URI m_uri
ClientResourcem_resource
ObjList m_contacts

Friends

class ClientContact


Detailed Description

A client account.

This class holds data about an account that can be registered to a server. It also holds a list of contacts belonging to this account. The account's id is kept in a lower case URI


Constructor & Destructor Documentation

ClientAccount ( const char *  proto,
const char *  user,
const char *  host,
bool  startup 
)

Constructor

Parameters:
proto The account's protocol
user The account's username
host The account's host
startup True if the account should login at startup

ClientAccount ( const NamedList params  ) 

Constructor. Build an account from a list of parameters

Parameters:
params The list of parameters used to build this account


Member Function Documentation

const URI& uri (  )  const [inline]

Get this account's URI

Returns:
This account's URI

const URI& id (  )  const [inline]

Get this account's id

Returns:
This account's id

ObjList& contacts (  )  [inline]

Get this account's contacts. The caller should lock the account while browsing the list

Returns:
This account's contacts list

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

Get a string representation of this object

Returns:
The account's compare id

Reimplemented from GenObject.

ClientResource* resource ( bool  ref = false  ) 

Get this account's resource

Returns:
ClientResource pointer or 0

void setResource ( ClientResource res = 0  ) 

Set/reset this account's resource

Parameters:
res The new account's resource

virtual ClientContact* findContact ( const String id,
bool  ref = false 
) [virtual]

Find a contact by its id

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

virtual ClientContact* findContact ( const String id,
const String resid,
bool  ref = false 
) [virtual]

Find a contact having a given id and resource

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

virtual ClientContact* appendContact ( const String id,
const char *  name 
) [virtual]

Build a contact and append it to the list

Parameters:
id The contact's id
name The contact's name
Returns:
ClientContact pointer or 0 if a contact with the given id already exists

virtual ClientContact* appendContact ( const NamedList params  )  [virtual]

Build a contact and append it to the list

Parameters:
params Contact parameters
Returns:
ClientContact pointer or 0 if a contact with the same id already exists

virtual ClientContact* removeContact ( const String id,
bool  delObj = true 
) [virtual]

Remove a contact from list. Reset contact's owner

Parameters:
id The contact's id
delObj True to delete the object if found
Returns:
ClientContact pointer if found and not deleted or 0

virtual Message* userlogin ( bool  login,
const char *  msg = "user.login" 
) [virtual]

Build a login/logout message from account's data

Parameters:
login True to login, false to logout
msg Optional message name. Default to 'user.login'
Returns:
A valid Message pointer

static void buildAccountId ( URI dest,
const char *  proto,
const char *  user,
const char *  host 
) [inline, static]

Build an account id

Parameters:
dest Destination URI
proto The account's protocol
user The account's username
host The account's host

References String::toLower().

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.


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

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