#include <account.hpp>
Public Member Functions | |
Account (int id=-1) | |
Constructor. | |
~Account () | |
Destructor. | |
void | setName (const std::string &name) |
Set the user name. | |
const std::string & | getName () const |
Get the user name. | |
void | setPassword (const std::string &password) |
Set the user password. | |
const std::string & | getPassword () const |
Get the user password (hashed with salt). | |
void | setEmail (const std::string &email) |
Set the user email address. | |
const std::string & | getEmail () const |
Get the user email address (hashed). | |
void | setLevel (int level) |
Set the account level. | |
int | getLevel () const |
Get the account level. | |
void | setCharacters (const Characters &characters) |
Set the characters. | |
void | addCharacter (Character *character) |
Add a new character. | |
void | delCharacter (int i) |
Removes a character from the account. | |
Characters & | getCharacters () |
Get all the characters. | |
const Characters & | getCharacters () const |
Get all the characters. | |
int | getID () const |
Get account ID. | |
void | setID (int) |
Set account ID. | |
time_t | getRegistrationDate () const |
Get the time of the account registration. | |
void | setRegistrationDate (time_t time) |
Sets the time of the account registration. | |
time_t | getLastLogin () const |
Get the time of the last login. | |
void | setLastLogin (time_t time) |
Sets the time of the last login. |
Stores the account information as well as the player characters available under this account.
Definition at line 34 of file account.hpp.
void Account::setName | ( | const std::string & | name | ) | [inline] |
const std::string& Account::getName | ( | ) | const [inline] |
Get the user name.
Definition at line 63 of file account.hpp.
Referenced by DALStorage::addAccount(), and DALStorage::flush().
void Account::setPassword | ( | const std::string & | password | ) | [inline] |
Set the user password.
The password is expected to be already hashed with a salt.
The hashing must be performed externally from this class or else we would end up with the password being hashed many times (e.g setPassword(getPassword()) would hash the password twice.
password | the user password (hashed with salt). |
Definition at line 77 of file account.hpp.
const std::string& Account::getPassword | ( | ) | const [inline] |
Get the user password (hashed with salt).
Definition at line 86 of file account.hpp.
Referenced by DALStorage::addAccount(), and DALStorage::flush().
void Account::setEmail | ( | const std::string & | ) | [inline] |
Set the user email address.
The email address is expected to be already hashed.
the user email address (hashed). |
Definition at line 96 of file account.hpp.
const std::string& Account::getEmail | ( | ) | const [inline] |
Get the user email address (hashed).
Definition at line 105 of file account.hpp.
Referenced by DALStorage::addAccount(), and DALStorage::flush().
void Account::setLevel | ( | int | level | ) | [inline] |
int Account::getLevel | ( | ) | const [inline] |
Get the account level.
Definition at line 123 of file account.hpp.
Referenced by DALStorage::addAccount(), DALStorage::flush(), and Character::setAccount().
void Account::setCharacters | ( | const Characters & | characters | ) |
Set the characters.
characters | a list of characters. |
Definition at line 42 of file account.cpp.
Referenced by DALStorage::delAccount().
void Account::addCharacter | ( | Character * | character | ) |
Add a new character.
character | the new character. |
Definition at line 51 of file account.cpp.
void Account::delCharacter | ( | int | i | ) |
Removes a character from the account.
i | index of the character. |
Definition at line 56 of file account.cpp.
Characters& Account::getCharacters | ( | ) | [inline] |
Get all the characters.
Definition at line 156 of file account.hpp.
Referenced by DALStorage::addAccount(), and DALStorage::flush().
const Characters& Account::getCharacters | ( | ) | const [inline] |
int Account::getID | ( | ) | const [inline] |
Get account ID.
Definition at line 172 of file account.hpp.
Referenced by DALStorage::delAccount(), DALStorage::flush(), Character::setAccount(), and DALStorage::updateLastLogin().
void Account::setID | ( | int | id | ) |
Set account ID.
The account shall not have any ID yet.
Definition at line 61 of file account.cpp.
Referenced by DALStorage::addAccount().
void Account::setRegistrationDate | ( | time_t | time | ) |
Sets the time of the account registration.
time | of the account registration. |
Definition at line 67 of file account.cpp.
void Account::setLastLogin | ( | time_t | time | ) |
Sets the time of the last login.
time | of the last login. |
Definition at line 72 of file account.cpp.