ClientAccount Class Reference
An account.
More...
#include <yatecbase.h>
List of all members.
|
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 Attributes |
NamedList | m_params |
Configuration | m_cfg |
Protected Member Functions |
virtual void | destroyed () |
virtual void | appendContact (ClientContact *contact, bool muc=false) |
Protected Attributes |
ObjList | m_contacts |
ObjList | m_mucs |
Friends |
class | ClientContact |
class | MucRoom |
Detailed Description
An account.
This class holds an account
Constructor & Destructor Documentation
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 |
| contact | Optional account's own contact |
Constructor. Build an account from a list of parameters
- 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 |
Member Function Documentation
Get this account's parameters
- Returns:
- This account's parameter list
Get this account's contacts. The caller should lock the account while browsing the list
- Returns:
- This account's contacts list
Get this account's muc rooms. The caller should lock the account while browsing the list
- Returns:
- This account's mucs list
Set or reset account own contact
- Parameters:
-
| contact | New account contact (may be NULL to reset it) |
const String& protocol |
( |
|
) |
const [inline] |
Retrieve the account's protocol
- Returns:
- The account's protocol
bool hasChat |
( |
|
) |
const [inline] |
Check if the account's protocol has chat support
- Returns:
- True if this account has chat support
bool hasPresence |
( |
|
) |
const [inline] |
Check if the account's protocol has presence support
- Returns:
- True if this account has presence support
bool startup |
( |
|
) |
const [inline] |
Check if the account should be logged in at startup
- Returns:
- True if the account should be logged in at startup
void startup |
( |
bool |
ok |
) |
[inline] |
Set the account's startup login flag
- Parameters:
-
| ok | The account's startup login flag value |
References String::boolText().
virtual const String& toString |
( |
|
) |
const [inline, virtual] |
Get a string representation of this object
- Returns:
- The account's compare id
Reimplemented from GenObject.
Set this account's resource
- Parameters:
-
| res | The new account's resource (ignored if 0) |
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
- Parameters:
-
| ok | True to save, false to remove |
| savePwd | True to save the password |
- Returns:
- True on success
Find a contact by its id
- Parameters:
-
| id | The id of the desired contact |
| ref | True to obtain a referenced pointer |
- Returns:
- ClientContact pointer (may be account's own contact) or 0 if not found
Find a contact by name and/or uri. Account own contact is ignored
- Parameters:
-
| 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 |
- Returns:
- ClientContact pointer or 0 if not found
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
Find a contact by its URI (build an id from account and uri)
- Parameters:
-
| uri | The contact's uri |
| ref | True to get a referenced pointer |
- Returns:
- ClientContact pointer or 0 if not found
virtual MucRoom* findRoom |
( |
const String & |
id, |
|
|
bool |
ref = false | |
|
) |
| | [virtual] |
Find a MUC room by its id
- Parameters:
-
| id | Room id |
| ref | True to obtain a referenced pointer |
- Returns:
- MucRoom pointer or 0 if not found
virtual MucRoom* findRoomByUri |
( |
const String & |
uri, |
|
|
bool |
ref = false | |
|
) |
| | [virtual] |
Find a MUC room by its uri
- Parameters:
-
| uri | Room uri |
| ref | True to obtain a referenced pointer |
- Returns:
- MucRoom pointer or 0 if not found
Find any contact (regular or MUC room) by its id
- Parameters:
-
| id | The id of the desired contact |
| ref | True to obtain a referenced pointer |
- Returns:
- ClientContact pointer (may be account's own contact) or 0 if not found
virtual ClientContact* appendContact |
( |
const String & |
id, |
|
|
const char * |
name, |
|
|
const char * |
uri = 0 | |
|
) |
| | [virtual] |
Build a contact and append it to the list
- Parameters:
-
| id | The contact's id |
| name | The contact's name |
| uri | Optional contact URI |
- Returns:
- ClientContact pointer or 0 if a contact with the given id already exists
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
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 void clearRooms |
( |
bool |
saved, |
|
|
bool |
temp | |
|
) |
| | [virtual] |
Clear MUC rooms. This method is thread safe
- Parameters:
-
| saved | True to clear saved rooms |
| temp | True to clear temporary rooms |
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
virtual Message* userData |
( |
bool |
update, |
|
|
const String & |
data, |
|
|
const char * |
msg = "user.data" | |
|
) |
| | [virtual] |
Build a message used to update or query account userdata. Add account MUC rooms if data is 'chatrooms' and update
- Parameters:
-
| update | True to update, false to query |
| data | Data to update or query |
| msg | Optional message name. Default to 'user.data' |
- Returns:
- A valid Message pointer
virtual void fillItemParams |
( |
NamedList & |
list |
) |
[virtual] |
Fill a list used to update a account's list item
- Parameters:
-
| list | Parameter list to fill |
const String& dataDir |
( |
|
) |
const [inline] |
Retrieve account data directory
- Returns:
- Account data directory
virtual bool setupDataDir |
( |
String * |
errStr = 0 , |
|
|
bool |
saveAcc = true | |
|
) |
| | [virtual] |
Set account directory in application data directory. Make sure it exists. Move all files from the old one if changed
- Parameters:
-
| errStr | Optional string to be filled with error string |
| saveAcc | Save data directory parameter in client accounts |
- Returns:
- True on success
virtual bool loadDataDirCfg |
( |
Configuration * |
cfg = 0 , |
|
|
const char * |
file = "account.conf" | |
|
) |
| | [virtual] |
Load configuration file from data directory
- Parameters:
-
| cfg | Optional configuration file to load. Load account's conf file if 0 |
| file | File name. Defaults to 'account.conf' |
- Returns:
- True on success
Load contacts from configuration file
- Parameters:
-
| cfg | Optional configuration file to load. Load from account's conf file if 0 |
virtual bool clearDataDir |
( |
String * |
errStr = 0 |
) |
[virtual] |
Clear account data directory
- Parameters:
-
| errStr | Optional string to be filled with error string |
- Returns:
- True if all files were succesfully removed
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: