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

ClientAccount Class Reference

Inheritance diagram for ClientAccount:
RefObject Mutex GenObject Lockable

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

Constructor & Destructor Documentation

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

Constructor

Parameters:
protoThe account's protocol
userThe account's username
hostThe account's host
startupTrue if the account should login at startup
ClientAccount ( const NamedList params)

Constructor. Build an account from a list of parameters

Parameters:
paramsThe list of parameters used to build this account

Member Function Documentation

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

Build a contact and append it to the list

Parameters:
idThe contact's id
nameThe 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:
paramsContact parameters
Returns:
ClientContact pointer or 0 if a contact with the same id already exists
static void buildAccountId ( URI dest,
const char *  proto,
const char *  user,
const char *  host 
) [inline, static]

Build an account id

Parameters:
destDestination URI
protoThe account's protocol
userThe account's username
hostThe account's host

References String::toLower().

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 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 ClientContact* findContact ( const String id,
const String resid,
bool  ref = false 
) [virtual]

Find a contact having a given id and resource

Parameters:
idThe id of the desired contact
residThe id of the desired resource
refTrue to obtain a referenced pointer
Returns:
ClientContact pointer or 0 if not found
virtual ClientContact* findContact ( const String id,
bool  ref = false 
) [virtual]

Find a contact by its id

Parameters:
idThe id of the desired contact
refTrue to obtain a referenced pointer
Returns:
ClientContact pointer or 0 if not found
const URI& id ( ) const [inline]

Get this account's id

Returns:
This account's id
virtual ClientContact* removeContact ( const String id,
bool  delObj = true 
) [virtual]

Remove a contact from list. Reset contact's owner

Parameters:
idThe contact's id
delObjTrue to delete the object if found
Returns:
ClientContact pointer if found and not deleted or 0
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:
resThe new account's resource
virtual const String& toString ( ) const [inline, virtual]

Get a string representation of this object

Returns:
The account's compare id

Reimplemented from GenObject.

const URI& uri ( ) const [inline]

Get this account's URI

Returns:
This account's URI
virtual Message* userlogin ( bool  login,
const char *  msg = "user.login" 
) [virtual]

Build a login/logout message from account's data

Parameters:
loginTrue to login, false to logout
msgOptional message name. Default to 'user.login'
Returns:
A valid Message pointer

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