diff options
author | Andreas Habel <mail@exceptionfault.de> | 2008-09-10 12:50:23 +0000 |
---|---|---|
committer | Andreas Habel <mail@exceptionfault.de> | 2008-09-10 12:50:23 +0000 |
commit | 0849156e914d76dfd0ad0129fdaef3c512219f53 (patch) | |
tree | 4c1f049b3a77d461be9a24daf2458814267762f2 /src/account-server/accounthandler.cpp | |
parent | 187dfc0418e44d4f20310b297d9d76e4d631ba9f (diff) | |
download | manaserv-0849156e914d76dfd0ad0129fdaef3c512219f53.tar.gz manaserv-0849156e914d76dfd0ad0129fdaef3c512219f53.tar.bz2 manaserv-0849156e914d76dfd0ad0129fdaef3c512219f53.tar.xz manaserv-0849156e914d76dfd0ad0129fdaef3c512219f53.zip |
* Extended tmw_accounts table with columns for lastlogin and registration date. Modified account-server to fill the new columns on registration and login. Recreation of database needed!
* Added createIndex function to create indexes on tables.
Diffstat (limited to 'src/account-server/accounthandler.cpp')
-rw-r--r-- | src/account-server/accounthandler.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp index 649aa267..56c03b31 100644 --- a/src/account-server/accounthandler.cpp +++ b/src/account-server/accounthandler.cpp @@ -207,6 +207,13 @@ static void handleLoginMessage(AccountClient &computer, MessageIn &msg) return; } + // set lastLogin date of the account + time_t login; + time(&login); + acc->setLastLogin(login); + storage->updateLastLogin(acc); + + // Associate account with connection computer.setAccount(acc); computer.status = CLIENT_CONNECTED; @@ -330,6 +337,12 @@ static void handleRegisterMessage(AccountClient &computer, MessageIn &msg) acc->setEmail(sha256(email)); acc->setLevel(AL_NORMAL); + // set the date and time of the account registration, and the last login + time_t regdate; + time(®date); + acc->setRegistrationDate(regdate); + acc->setLastLogin(regdate); + storage->addAccount(acc); reply.writeByte(ERRMSG_OK); |