class ClientAccount

An account. More...

Full nameTelEngine::ClientAccount
Definition#include <yatecbase.h>
InheritsTelEngine::Mutex [public ], TelEngine::RefObject [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Members

Protected Methods

Protected Members


Detailed Description

This class holds an account

explicit  ClientAccount (const char* proto, const char* user, const char* host, bool startup, ClientContact* contact = 0)

ClientAccount

Constructor

Parameters:
protoThe account's protocol
userThe account's username
hostThe account's host
startupTrue if the account should login at startup
contactOptional account's own contact

explicit  ClientAccount (const NamedList& params, ClientContact* contact = 0)

ClientAccount

Constructor. Build an account from a list of parameters

Parameters:
paramsThe list of parameters used to build this account. The list's name will be used as account id
contactOptional account's own contact

inline const NamedList&  params ()

params

[const]

Get this account's parameters

Returns: This account's parameter list

inline ObjList&  contacts ()

contacts

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

Returns: This account's contacts list

inline ObjList&  mucs ()

mucs

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

Returns: This account's mucs list

inline ClientContact*  contact ()

contact

[const]

Retrieve account own contact

Returns: ClientContact pointer

void  setContact (ClientContact* contact)

setContact

Set or reset account own contact

Parameters:
contactNew account contact (may be NULL to reset it)

inline const String&  protocol ()

protocol

[const]

Retrieve the account's protocol

Returns: The account's protocol

inline bool  hasChat ()

hasChat

[const]

Check if the account's protocol has chat support

Returns: True if this account has chat support

inline bool  hasPresence ()

hasPresence

[const]

Check if the account's protocol has presence support

Returns: True if this account has presence support

inline bool  startup ()

startup

[const]

Check if the account should be logged in at startup

Returns: True if the account should be logged in at startup

inline void  startup (bool ok)

startup

Set the account's startup login flag

Parameters:
okThe account's startup login flag value

const String&  toString ()

toString

[const virtual]

Get a string representation of this object

Returns: The account's compare id

Reimplemented from GenObject.

ClientResource*  resource (bool ref)

resource

Get this account's resource

Returns: ClientResource pointer

inline ClientResource&  resource ()

resource

[const]

Get this account's resource

Returns: ClientResource reference

void  setResource (ClientResource* res)

setResource

Set this account's resource

Parameters:
resThe new account's resource (ignored if 0)

bool  save (bool ok = true, bool savePwd = true)

save

Save or remove this account to/from client accounts file. Parameters starting with "internal." are not saved

Parameters:
okTrue to save, false to remove
savePwdTrue to save the password

Returns: True on success

ClientContact*  findContact (const String& id, bool ref = false)

findContact

[virtual]

Find a contact by its id

Parameters:
idThe id of the desired contact
refTrue to obtain a referenced pointer

Returns: ClientContact pointer (may be account's own contact) or 0 if not found

ClientContact*  findContact (const String* name = 0, const String* uri = 0, const String* skipId = 0, bool ref = false)

findContact

[virtual]

Find a contact by name and/or uri. Account own contact is ignored

Parameters:
nameOptional name to check (may be a pointer to an empty string)
uriOptional uri to check (may be a pointer to an empty string)
skipIdOptional contact to skip
refTrue to obtain a referenced pointer

Returns: ClientContact pointer or 0 if not found

ClientContact*  findContact (const String& id, const String& resid, bool ref = false)

findContact

[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

ClientContact*  findContactByUri (const String& uri, bool ref = false)

findContactByUri

[virtual]

Find a contact by its URI (build an id from account and uri)

Parameters:
uriThe contact's uri
refTrue to get a referenced pointer

Returns: ClientContact pointer or 0 if not found

MucRoom*  findRoom (const String& id, bool ref = false)

findRoom

[virtual]

Find a MUC room by its id

Parameters:
idRoom id
refTrue to obtain a referenced pointer

Returns: MucRoom pointer or 0 if not found

MucRoom*  findRoomByUri (const String& uri, bool ref = false)

findRoomByUri

[virtual]

Find a MUC room by its uri

Parameters:
uriRoom uri
refTrue to obtain a referenced pointer

Returns: MucRoom pointer or 0 if not found

ClientContact*  findAnyContact (const String& id, bool ref = false)

findAnyContact

[virtual]

Find any contact (regular or MUC room) by its id

Parameters:
idThe id of the desired contact
refTrue to obtain a referenced pointer

Returns: ClientContact pointer (may be account's own contact) or 0 if not found

ClientContact*  appendContact (const String& id, const char* name, const char* uri = 0)

appendContact

[virtual]

Build a contact and append it to the list

Parameters:
idThe contact's id
nameThe contact's name
uriOptional contact URI

Returns: ClientContact pointer or 0 if a contact with the given id already exists

ClientContact*  appendContact (const NamedList& params)

appendContact

[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

ClientContact*  removeContact (const String& id, bool delObj = true)

removeContact

[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

void  clearRooms (bool saved, bool temp)

clearRooms

[virtual]

Clear MUC rooms. This method is thread safe

Parameters:
savedTrue to clear saved rooms
tempTrue to clear temporary rooms

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

userlogin

[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

Message*  userData (bool update, const String& data, const char* msg = "user.data")

userData

[virtual]

Build a message used to update or query account userdata. Add account MUC rooms if data is 'chatrooms' and update

Parameters:
updateTrue to update, false to query
dataData to update or query
msgOptional message name. Default to 'user.data'

Returns: A valid Message pointer

void  fillItemParams (NamedList& list)

fillItemParams

[virtual]

Fill a list used to update a account's list item

Parameters:
listParameter list to fill

inline const String&  dataDir ()

dataDir

[const]

Retrieve account data directory

Returns: Account data directory

bool  setupDataDir (String* errStr = 0, bool saveAcc = true)

setupDataDir

[virtual]

Set account directory in application data directory. Make sure it exists. Move all files from the old one if changed

Parameters:
errStrOptional string to be filled with error string
saveAccSave data directory parameter in client accounts

Returns: True on success

bool  loadDataDirCfg (Configuration* cfg = 0, const char* file = "account.conf")

loadDataDirCfg

[virtual]

Load configuration file from data directory

Parameters:
cfgOptional configuration file to load. Load account's conf file if 0
fileFile name. Defaults to 'account.conf'

Returns: True on success

void  loadContacts (Configuration* cfg = 0)

loadContacts

[virtual]

Load contacts from configuration file

Parameters:
cfgOptional configuration file to load. Load from account's conf file if 0

bool  clearDataDir (String* errStr = 0)

clearDataDir

[virtual]

Clear account data directory

Parameters:
errStrOptional string to be filled with error string

Returns: True if all files were succesfully removed

NamedList m_params

m_params

Configuration m_cfg

m_cfg

void  destroyed ()

destroyed

[protected virtual]

Reimplemented from RefObject.

void  appendContact (ClientContact* contact, bool muc = false)

appendContact

[protected virtual]

ObjList m_contacts

m_contacts

[protected]

ObjList m_mucs

m_mucs

[protected]


Generated by: paulc on bussard on Fri Dec 21 16:28:34 2012, using kdoc 2.0a54.