diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-04-06 02:15:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-04-06 02:15:54 +0300 |
commit | d70cdbc7ab543988d16712a5981a54bd853620cc (patch) | |
tree | 46ecb257860ad2c12c3818abcb7c4a6c87d175ff /src/net/ea | |
parent | 0d3b6da53db29cdf0ee2648fb9b0a02dd1d82dc8 (diff) | |
download | plus-d70cdbc7ab543988d16712a5981a54bd853620cc.tar.gz plus-d70cdbc7ab543988d16712a5981a54bd853620cc.tar.bz2 plus-d70cdbc7ab543988d16712a5981a54bd853620cc.tar.xz plus-d70cdbc7ab543988d16712a5981a54bd853620cc.zip |
improve loginhandler class.
Diffstat (limited to 'src/net/ea')
-rw-r--r-- | src/net/ea/loginhandler.cpp | 25 | ||||
-rw-r--r-- | src/net/ea/loginhandler.h | 36 |
2 files changed, 31 insertions, 30 deletions
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 56538687f..ea4452528 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -50,18 +50,18 @@ LoginHandler::~LoginHandler() delete_all(mWorlds); } -bool LoginHandler::isRegistrationEnabled() +bool LoginHandler::isRegistrationEnabled() const { return mRegistrationEnabled; } -void LoginHandler::getRegistrationDetails() +void LoginHandler::getRegistrationDetails() const { // Not supported, so move on Client::setState(STATE_REGISTER); } -void LoginHandler::loginAccount(LoginData *loginData) +void LoginHandler::loginAccount(LoginData *const loginData) const { if (loginData) @@ -76,7 +76,7 @@ void LoginHandler::loginAccount(LoginData *loginData) } } -void LoginHandler::chooseServer(unsigned int server) +void LoginHandler::chooseServer(const unsigned int server) const { if (server >= mWorlds.size() || !mWorlds[server]) return; @@ -94,7 +94,7 @@ void LoginHandler::chooseServer(unsigned int server) Client::setState(STATE_UPDATE); } -void LoginHandler::registerAccount(LoginData *loginData) +void LoginHandler::registerAccount(LoginData *const loginData) const { if (!loginData) return; @@ -130,7 +130,7 @@ void LoginHandler::clearWorlds() mWorlds.clear(); } -void LoginHandler::procecessCharPasswordResponse(Net::MessageIn &msg) +void LoginHandler::procecessCharPasswordResponse(Net::MessageIn &msg) const { // 0: acc not found, 1: success, 2: password mismatch, 3: pass too short const int errMsg = msg.readInt8(); @@ -164,9 +164,7 @@ void LoginHandler::procecessCharPasswordResponse(Net::MessageIn &msg) void LoginHandler::processUpdateHost(Net::MessageIn &msg) { - int len; - - len = msg.readInt16() - 4; + int len = msg.readInt16() - 4; mUpdateHost = msg.readString(len); if (!checkPath(mUpdateHost)) @@ -221,7 +219,7 @@ void LoginHandler::processLoginData(Net::MessageIn &msg) Client::setState(STATE_WORLD_SELECT); } -void LoginHandler::processLoginError(Net::MessageIn &msg) +void LoginHandler::processLoginError(Net::MessageIn &msg) const { const int code = msg.readInt8(); logger->log("Login::error code: %i", code); @@ -277,18 +275,19 @@ void LoginHandler::processLoginError(Net::MessageIn &msg) Client::setState(STATE_ERROR); } -void LoginHandler::logout() +void LoginHandler::logout() const { // TODO } -void LoginHandler::changeEmail(const std::string &email A_UNUSED) +void LoginHandler::changeEmail(const std::string &email A_UNUSED) const { // TODO } void LoginHandler::unregisterAccount(const std::string &username A_UNUSED, - const std::string &password A_UNUSED) + const std::string &password + A_UNUSED) const { // TODO } diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h index b4f9d2f5c..eb81ceb6f 100644 --- a/src/net/ea/loginhandler.h +++ b/src/net/ea/loginhandler.h @@ -45,54 +45,56 @@ class LoginHandler : public Net::LoginHandler ~LoginHandler(); - int supportedOptionalActions() const A_WARN_UNUSED + int supportedOptionalActions() const override A_WARN_UNUSED { return SetGenderOnRegister; } - virtual bool isRegistrationEnabled() A_WARN_UNUSED; + virtual bool isRegistrationEnabled() const override A_WARN_UNUSED; - virtual void getRegistrationDetails(); + virtual void getRegistrationDetails() const override; - virtual unsigned int getMaxPasswordLength() const A_WARN_UNUSED + virtual unsigned int getMaxPasswordLength() const + override A_WARN_UNUSED { return 25; } - virtual void loginAccount(LoginData *loginData); + virtual void loginAccount(LoginData *const loginData) const override; - virtual void chooseServer(unsigned int server); + virtual void chooseServer(const unsigned int server) const override; - virtual void registerAccount(LoginData *loginData); + virtual void registerAccount(LoginData *const loginData) const override; - virtual Worlds getWorlds() const A_WARN_UNUSED; + virtual Worlds getWorlds() const override A_WARN_UNUSED; - virtual void clearWorlds(); + virtual void clearWorlds() override; - virtual ServerInfo *getCharServer() A_WARN_UNUSED = 0; + virtual ServerInfo *getCharServer() const A_WARN_UNUSED = 0; const Token &getToken() const A_WARN_UNUSED { return mToken; } - virtual void logout(); + virtual void logout() const override; - virtual void changeEmail(const std::string &email); + virtual void changeEmail(const std::string &email) const override; virtual void unregisterAccount(const std::string &username, - const std::string &password); + const std::string &password) + const override; - virtual void procecessCharPasswordResponse(Net::MessageIn &msg); + virtual void procecessCharPasswordResponse(Net::MessageIn &msg) const; virtual void processUpdateHost(Net::MessageIn &msg); - virtual void processUpdateHost2(Net::MessageIn &msg) = 0; + virtual void processUpdateHost2(Net::MessageIn &msg) const = 0; virtual void processLoginData(Net::MessageIn &msg); - virtual void processLoginError(Net::MessageIn &msg); + virtual void processLoginError(Net::MessageIn &msg) const; virtual void processServerVersion(Net::MessageIn &msg) = 0; protected: virtual void sendLoginRegister(const std::string &username, const std::string &password, - const std::string &email) = 0; + const std::string &email) const = 0; bool mVersionResponse; bool mRegistrationEnabled; |