|
Yate
|
An account. More...
#include <yatecbase.h>
Public Member Functions | |
| ClientAccount (const char *proto, const char *user, const char *host, bool startup, ClientContact *contact=0) | |
| ClientAccount (const NamedList ¶ms, ClientContact *contact=0) | |
| const NamedList & | params () const |
| ObjList & | contacts () |
| ObjList & | mucs () |
| ClientContact * | contact () const |
| void | setContact (ClientContact *contact) |
| const String & | protocol () const |
| bool | hasChat () const |
| bool | hasPresence () const |
| bool | startup () const |
| void | startup (bool ok) |
| virtual const String & | toString () const |
| ClientResource * | resource (bool ref) |
| ClientResource & | resource () const |
| void | setResource (ClientResource *res) |
| bool | save (bool ok=true, bool savePwd=true) |
| virtual ClientContact * | findContact (const String &id, bool ref=false) |
| virtual ClientContact * | findContact (const String *name=0, const String *uri=0, const String *skipId=0, bool ref=false) |
| virtual ClientContact * | findContact (const String &id, const String &resid, bool ref=false) |
| virtual ClientContact * | findContactByUri (const String &uri, bool ref=false) |
| virtual MucRoom * | findRoom (const String &id, bool ref=false) |
| virtual MucRoom * | findRoomByUri (const String &uri, bool ref=false) |
| virtual ClientContact * | findAnyContact (const String &id, bool ref=false) |
| virtual ClientContact * | appendContact (const String &id, const char *name, const char *uri=0) |
| virtual ClientContact * | appendContact (const NamedList ¶ms) |
| virtual ClientContact * | removeContact (const String &id, bool delObj=true) |
| virtual void | clearRooms (bool saved, bool temp) |
| virtual Message * | userlogin (bool login, const char *msg="user.login") |
| virtual Message * | userData (bool update, const String &data, const char *msg="user.data") |
| virtual void | fillItemParams (NamedList &list) |
| const String & | dataDir () const |
| virtual bool | setupDataDir (String *errStr=0, bool saveAcc=true) |
| virtual bool | loadDataDirCfg (Configuration *cfg=0, const char *file="account.conf") |
| virtual void | loadContacts (Configuration *cfg=0) |
| virtual bool | clearDataDir (String *errStr=0) |
Public Member Functions inherited from RefObject | |
| RefObject () | |
| virtual | ~RefObject () |
| virtual void * | getObject (const String &name) const |
| virtual bool | alive () const |
| bool | ref () |
| bool | deref () |
| int | refcount () const |
| virtual void | destruct () |
Public Member Functions inherited from GenObject | |
| GenObject () | |
| virtual | ~GenObject () |
| NamedCounter * | getObjCounter () const |
| NamedCounter * | setObjCounter (NamedCounter *counter) |
Public Member Functions inherited from Mutex | |
| Mutex (bool recursive=false, const char *name=0) | |
| Mutex (const Mutex &original) | |
| ~Mutex () | |
| Mutex & | operator= (const Mutex &original) |
| virtual bool | lock (long maxwait=-1) |
| virtual bool | unlock () |
| virtual bool | locked () const |
| const char * | owner () const |
| bool | recursive () const |
Public Member Functions inherited from Lockable | |
| virtual | ~Lockable () |
| virtual bool | check (long maxwait=-1) |
| virtual bool | unlockAll () |
Public Attributes | |
| NamedList | m_params |
| Configuration | m_cfg |
Protected Member Functions | |
| virtual void | destroyed () |
| virtual void | appendContact (ClientContact *contact, bool muc=false) |
Protected Member Functions inherited from RefObject | |
| virtual void | zeroRefs () |
| bool | resurrect () |
Protected Attributes | |
| ObjList | m_contacts |
| ObjList | m_mucs |
Friends | |
| class | ClientContact |
| class | MucRoom |
Additional Inherited Members | |
Static Public Member Functions inherited from RefObject | |
| static bool | alive (const RefObject *obj) |
| static bool | efficientIncDec () |
Static Public Member Functions inherited from GenObject | |
| static void * | getObject (const String &name, const GenObject *obj) |
| static bool | getObjCounting () |
| static void | setObjCounting (bool enable) |
| static NamedCounter * | getObjCounter (const String &name, bool create=true) |
| static ObjList & | getObjCounters () |
Static Public Member Functions inherited from Mutex | |
| static int | count () |
| static int | locks () |
| static bool | efficientTimedLock () |
Static Public Member Functions inherited from Lockable | |
| static void | wait (unsigned long maxwait) |
| static unsigned long | wait () |
| static void | startUsingNow () |
| static void | enableSafety (bool safe=true) |
| static bool | safety () |
An account.
This class holds an account
|
explicit |
Constructor
| proto | The account's protocol |
| user | The account's username |
| host | The account's host |
| startup | True if the account should login at startup |
| contact | Optional account's own contact |
|
explicit |
Constructor. Build an account from a list of parameters
| params | The list of parameters used to build this account. The list's name will be used as account id |
| contact | Optional account's own contact |
|
virtual |
Build a contact and append it to the list
| id | The contact's id |
| name | The contact's name |
| uri | Optional contact URI |
|
virtual |
Build a contact and append it to the list
| params | Contact parameters |
|
virtual |
Clear account data directory
| errStr | Optional string to be filled with error string |
|
virtual |
Clear MUC rooms. This method is thread safe
| saved | True to clear saved rooms |
| temp | True to clear temporary rooms |
|
inline |
Retrieve account own contact
|
inline |
Get this account's contacts. The caller should lock the account while browsing the list
|
inline |
|
protectedvirtual |
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 |
Fill a list used to update a account's list item
| list | Parameter list to fill |
|
virtual |
Find any contact (regular or MUC room) by its id
| id | The id of the desired contact |
| ref | True to obtain a referenced pointer |
|
virtual |
Find a contact by its id
| id | The id of the desired contact |
| ref | True to obtain a referenced pointer |
Referenced by ClientAccountList::isLocalContact().
|
virtual |
Find a contact by name and/or uri. Account own contact is ignored
| name | Optional name to check (may be a pointer to an empty string) |
| uri | Optional uri to check (may be a pointer to an empty string) |
| skipId | Optional contact to skip |
| ref | True to obtain a referenced pointer |
|
virtual |
Find a contact having a given id and resource
| id | The id of the desired contact |
| resid | The id of the desired resource |
| ref | True to obtain a referenced pointer |
|
virtual |
Find a contact by its URI (build an id from account and uri)
| uri | The contact's uri |
| ref | True to get a referenced pointer |
Find a MUC room by its id
| id | Room id |
| ref | True to obtain a referenced pointer |
Find a MUC room by its uri
| uri | Room uri |
| ref | True to obtain a referenced pointer |
|
inline |
Check if the account's protocol has chat support
References ClientAccount::protocol(), and TelEngine::YSTRING().
|
inline |
Check if the account's protocol has presence support
References ClientAccount::protocol(), and TelEngine::YSTRING().
|
virtual |
Load contacts from configuration file
| cfg | Optional configuration file to load. Load from account's conf file if 0 |
|
virtual |
Load configuration file from data directory
| cfg | Optional configuration file to load. Load account's conf file if 0 |
| file | File name. Defaults to 'account.conf' |
|
inline |
Get this account's muc rooms. The caller should lock the account while browsing the list
|
inline |
Get this account's parameters
|
inline |
Retrieve the account's protocol
References TelEngine::YSTRING().
Referenced by ClientAccount::hasChat(), and ClientAccount::hasPresence().
|
virtual |
Remove a contact from list. Reset contact's owner
| id | The contact's id |
| delObj | True to delete the object if found |
| ClientResource* resource | ( | bool | ref | ) |
Get this account's resource
|
inline |
Get this account's resource
| bool save | ( | bool | ok = true, |
| bool | savePwd = true |
||
| ) |
Save or remove this account to/from client accounts file. Parameters starting with "internal." are not saved
| ok | True to save, false to remove |
| savePwd | True to save the password |
| void setContact | ( | ClientContact * | contact | ) |
Set or reset account own contact
| contact | New account contact (may be NULL to reset it) |
| void setResource | ( | ClientResource * | res | ) |
Set this account's resource
| res | The new account's resource (ignored if 0) |
|
virtual |
Set account directory in application data directory. Make sure it exists. Move all files from the old one if changed
| errStr | Optional string to be filled with error string |
| saveAcc | Save data directory parameter in client accounts |
|
inline |
Check if the account should be logged in at startup
References NamedList::getBoolValue(), and TelEngine::YSTRING().
|
inline |
Set the account's startup login flag
| ok | The account's startup login flag value |
References String::boolText(), and NamedList::setParam().
|
inlinevirtual |
Get a string representation of this object
Reimplemented from GenObject.
Referenced by ClientContact::accountName().
|
virtual |
Build a message used to update or query account userdata. Add account MUC rooms if data is 'chatrooms' and update
| update | True to update, false to query |
| data | Data to update or query |
| msg | Optional message name. Default to 'user.data' |
|
virtual |
Build a login/logout message from account's data
| login | True to login, false to logout |
| msg | Optional message name. Default to 'user.login' |
1.8.8