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/tmwa | |
parent | 0d3b6da53db29cdf0ee2648fb9b0a02dd1d82dc8 (diff) | |
download | mv-d70cdbc7ab543988d16712a5981a54bd853620cc.tar.gz mv-d70cdbc7ab543988d16712a5981a54bd853620cc.tar.bz2 mv-d70cdbc7ab543988d16712a5981a54bd853620cc.tar.xz mv-d70cdbc7ab543988d16712a5981a54bd853620cc.zip |
improve loginhandler class.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/loginhandler.cpp | 18 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.h | 22 |
2 files changed, 19 insertions, 21 deletions
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index a3a9f3345..b68980969 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -107,7 +107,7 @@ void LoginHandler::connect() MessageOut outMsg(CMSG_SERVER_VERSION_REQUEST); } -bool LoginHandler::isConnected() +bool LoginHandler::isConnected() const { if (!mNetwork) return false; @@ -123,7 +123,7 @@ void LoginHandler::disconnect() void LoginHandler::changePassword(const std::string &username A_UNUSED, const std::string &oldPassword, - const std::string &newPassword) + const std::string &newPassword) const { MessageOut outMsg(CMSG_CHAR_PASSWORD_CHANGE); outMsg.writeStringNoLog(oldPassword, 24); @@ -132,7 +132,7 @@ void LoginHandler::changePassword(const std::string &username A_UNUSED, void LoginHandler::sendLoginRegister(const std::string &username, const std::string &password, - const std::string &email) + const std::string &email) const { if (email.empty()) { @@ -167,12 +167,12 @@ void LoginHandler::sendLoginRegister(const std::string &username, } } -ServerInfo *LoginHandler::getCharServer() +ServerInfo *LoginHandler::getCharServer() const { return &charServer; } -void LoginHandler::requestUpdateHosts() +void LoginHandler::requestUpdateHosts() const { MessageOut outMsg(CMSG_SEND_CLIENT_INFO); outMsg.writeInt8(CLIENT_PROTOCOL_VERSION); @@ -211,12 +211,10 @@ void LoginHandler::processServerVersion(Net::MessageIn &msg) mVersionResponse = true; } -void LoginHandler::processUpdateHost2(Net::MessageIn &msg) +void LoginHandler::processUpdateHost2(Net::MessageIn &msg) const { - int len; - - len = msg.readInt16() - 4; - std::string updateHost = msg.readString(len); + int len = msg.readInt16() - 4; + const std::string updateHost = msg.readString(len); splitToStringVector(loginData.updateHosts, updateHost, '|'); FOR_EACH (StringVectIter, it, loginData.updateHosts) diff --git a/src/net/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h index 4ca448108..6d8436fbd 100644 --- a/src/net/tmwa/loginhandler.h +++ b/src/net/tmwa/loginhandler.h @@ -45,35 +45,35 @@ class LoginHandler final : public MessageHandler, public Ea::LoginHandler ~LoginHandler(); - void handleMessage(Net::MessageIn &msg); + void handleMessage(Net::MessageIn &msg) override; - void connect(); + void connect() override; - bool isConnected() A_WARN_UNUSED; + bool isConnected() const override A_WARN_UNUSED; - void disconnect(); + void disconnect() override; - int supportedOptionalActions() const A_WARN_UNUSED; + int supportedOptionalActions() const override A_WARN_UNUSED; - unsigned int getMaxPasswordLength() const A_WARN_UNUSED + unsigned int getMaxPasswordLength() const override A_WARN_UNUSED { return 25; } void changePassword(const std::string &username, const std::string &oldPassword, - const std::string &newPassword); + const std::string &newPassword) const override; - ServerInfo *getCharServer() A_WARN_UNUSED; + ServerInfo *getCharServer() const override A_WARN_UNUSED; void processServerVersion(Net::MessageIn &msg); - void requestUpdateHosts(); + void requestUpdateHosts() const; - void processUpdateHost2(Net::MessageIn &msg); + void processUpdateHost2(Net::MessageIn &msg) const; private: void sendLoginRegister(const std::string &username, const std::string &password, - const std::string &email); + const std::string &email) const override; }; } // namespace TmwAthena |