Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

cAccounts Class Reference

Class for Account Management. More...

#include <accounts.h>

List of all members.

Public Methods

 cAccounts (void)
 Constructor of cAccount.

 ~cAccounts (void)
 Destructor of cAccount.

void SetSaveRatio (int)
void LoadAccounts ()
 Reload all account.

void SaveAccounts ()
 Save all account.

void CheckAccountFile ()
 Check the account file status.

int Count ()
 Get the number of account.

SI32 Authenticate (std::string username, std::string password)
 Get info about account by username and password.

bool AuthenticateRAS (std::string username, std::string password)
 Check if the user can use the RAS ( Remote Admin System ).

ACCOUNT CreateAccount (std::string username, std::string password)
 Create a new account.

bool IsOnline (ACCOUNT acctnum)
 Check if the Account is online.

SERIAL GetInWorld (ACCOUNT acctnum)
 Get char in game of given account.

void SetOnline (P_CHAR pc)
 Set Online the player.

void SetEntering (ACCOUNT acctnum)
 Account are loggin into.

void SetOffline (ACCOUNT acctnum)
 Set Offline the player.

void OnLogin (ACCOUNT acctnum, NXWSOCKET socket)
 Update account information.

SI32 verifyPassword (std::string username, std::string password)
 Verify a password, currently only needed by encryption due to two crypt versions returning a valid username, but one an invalid password.

SI32 ChangePassword (ACCOUNT acctnum, std::string password)
 Change the Password.

void AddCharToAccount (ACCOUNT acctnum, P_CHAR pc)
 Add given char to account.

void GetAllChars (ACCOUNT acctnum, NxwCharWrapper &sc)
 Get list of pg of this account.

ACCOUNT GetAccountByName (std::string name)
 Get an account from his name.

cAccountGetAccount (ACCOUNT acctnumb)
 Get an account from his name.

bool RemoveAccount (std::string name)
 Delete an account.


Public Attributes

UI32 lasttimecheck

Private Methods

void safeInsert (cAccount &acc)
 Safe insert info list.

void LoadAccount (ACCOUNT acctnumb, FILE *F)
 Reload the Account.


Private Attributes

ACCOUNT_LIST acctlist
 All Account, with info.

ACCOUNT_LIST_BY_NAME accbyname
 All Account by name.

UI32 lastusedacctnum
UI32 unsavedaccounts
UI32 saveratio


Detailed Description

Class for Account Management.


Constructor & Destructor Documentation

cAccounts::cAccounts void   
 

Constructor of cAccount.

cAccounts::~cAccounts void   
 

Destructor of cAccount.


Member Function Documentation

void cAccounts::AddCharToAccount ACCOUNT    acctnum,
P_CHAR    pc
 

Add given char to account.

Author:
Endymion
Parameters:
acctnum  the account
pc  the char

SI32 cAccounts::Authenticate std::string    username,
std::string    password
 

Get info about account by username and password.

Returns:
account, of why not right
Parameters:
username  Username
password  Password

bool cAccounts::AuthenticateRAS std::string    username,
std::string    password
 

Check if the user can use the RAS ( Remote Admin System ).

Returns:
true if can, false else
Parameters:
username  Username
password  Password
Remarks:
Always the Account n° 0 can use Ras

SI32 cAccounts::ChangePassword ACCOUNT    acctnum,
std::string    password
 

Change the Password.

Returns:
SI32 0 if ok, INVALID else
Parameters:
acctnum  Account number
password  new Password

void cAccounts::CheckAccountFile  
 

Check the account file status.

Remarks:
Reload Account if modified

int cAccounts::Count  
 

Get the number of account.

Returns:
int

ACCOUNT cAccounts::CreateAccount std::string    username,
std::string    password
 

Create a new account.

Returns:
ACCOUNT the account id or INVALID if not created
Parameters:
username  Username
password  Password

cAccount * cAccounts::GetAccount ACCOUNT    acctnumb
 

Get an account from his name.

Author:
Akron
Returns:
the account object, or INVALID if no accounts found
Parameters:
accname  the account name

ACCOUNT cAccounts::GetAccountByName std::string    accname
 

Get an account from his name.

Author:
Akron
Returns:
the account object, or INVALID if no accounts found
Parameters:
accname  the account name

void cAccounts::GetAllChars ACCOUNT    acctnum,
NxwCharWrapper   sc
 

Get list of pg of this account.

Returns:
SI32 0 if ok, INVALID else
Parameters:
acctnum  Account number
sc  the list

SERIAL cAccounts::GetInWorld ACCOUNT    acctnum
 

Get char in game of given account.

Returns:
Serial if exist, else INVALID
Parameters:
acctnum  Account Number

bool cAccounts::IsOnline ACCOUNT    acctnum
 

Check if the Account is online.

Returns:
boolean
Parameters:
acctnum  Account Number

void cAccounts::LoadAccount ACCOUNT    acctnumb,
FILE *    F
[private]
 

Reload the Account.

Parameters:
acctnumb  Account number
F  Account file

void cAccounts::LoadAccounts void   
 

Reload all account.

void cAccounts::OnLogin ACCOUNT    acct,
NXWSOCKET    sck
 

Update account information.

Parameters:
acct  Account number
sck  Socket

bool cAccounts::RemoveAccount std::string    name
 

Delete an account.

Author:
Akron
Returns:
true if account is deleted correctly, or false
Parameters:
name  the account name

void cAccounts::safeInsert cAccount   acc [private]
 

Safe insert info list.

Parameters:
acc  the account

void cAccounts::SaveAccounts void   
 

Save all account.

void cAccounts::SetEntering ACCOUNT    acctnum
 

Account are loggin into.

Parameters:
acctnum  Account number

void cAccounts::SetOffline ACCOUNT    acctnum
 

Set Offline the player.

Parameters:
acctnum  Account number

void cAccounts::SetOnline P_CHAR    pc
 

Set Online the player.

Parameters:
acctnum  Account number
pc  The Character

void cAccounts::SetSaveRatio int   
 

SI32 cAccounts::verifyPassword std::string    username,
std::string    password
 

Verify a password, currently only needed by encryption due to two crypt versions returning a valid username, but one an invalid password.

Returns:
account, of why not right
Parameters:
username  Username
password  Password


Member Data Documentation

ACCOUNT_LIST_BY_NAME cAccounts::accbyname [private]
 

All Account by name.

ACCOUNT_LIST cAccounts::acctlist [private]
 

All Account, with info.

UI32 cAccounts::lasttimecheck
 

UI32 cAccounts::lastusedacctnum [private]
 

UI32 cAccounts::saveratio [private]
 

UI32 cAccounts::unsavedaccounts [private]
 


The documentation for this class was generated from the following files: SourceForge.net Logo