From 3232aa8610c62b7e047dcf175b7d33e09bf77284 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 16 Dec 2014 13:38:32 +0300 Subject: Move processCharPasswordResponse from ea namespace into tmwa. --- src/net/ea/loginhandler.cpp | 36 ------------------------------------ src/net/ea/loginhandler.h | 2 -- src/net/tmwa/loginhandler.cpp | 38 ++++++++++++++++++++++++++++++++++++++ src/net/tmwa/loginhandler.h | 6 ++++-- 4 files changed, 42 insertions(+), 40 deletions(-) diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 34d5a0d02..5ebee0ded 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -138,42 +138,6 @@ void LoginHandler::clearWorlds() mWorlds.clear(); } -void LoginHandler::processCharPasswordResponse(Net::MessageIn &msg) -{ - // 0: acc not found, 1: success, 2: password mismatch, 3: pass too short - const uint8_t errMsg = msg.readUInt8("result code"); - // Successful pass change - if (errMsg == 1) - { - client->setState(STATE_CHANGEPASSWORD_SUCCESS); - } - // pass change failed - else - { - switch (errMsg) - { - case 0: - errorMessage = - // TRANSLATORS: error message - _("Account was not found. Please re-login."); - break; - case 2: - // TRANSLATORS: error message - errorMessage = _("Old password incorrect."); - break; - case 3: - // TRANSLATORS: error message - errorMessage = _("New password too short."); - break; - default: - // TRANSLATORS: error message - errorMessage = _("Unknown error."); - break; - } - client->setState(STATE_ACCOUNTCHANGE_ERROR); - } -} - void LoginHandler::processUpdateHost(Net::MessageIn &msg) { const int len = msg.readInt16("len") - 4; diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h index 93fe3fb2d..1b8c91c9a 100644 --- a/src/net/ea/loginhandler.h +++ b/src/net/ea/loginhandler.h @@ -87,8 +87,6 @@ class LoginHandler notfinal : public Net::LoginHandler const std::string &password) const override final; - static void processCharPasswordResponse(Net::MessageIn &msg); - static void processUpdateHost(Net::MessageIn &msg); static void processLoginData(Net::MessageIn &msg); diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 6bb484433..f3922d3f8 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -31,6 +31,8 @@ #include "net/tmwa/network.h" #include "net/tmwa/protocol.h" +#include "utils/gettext.h" + #include "debug.h" extern Net::LoginHandler *loginHandler; @@ -252,4 +254,40 @@ void LoginHandler::sendVersion() const { } +void LoginHandler::processCharPasswordResponse(Net::MessageIn &msg) +{ + // 0: acc not found, 1: success, 2: password mismatch, 3: pass too short + const uint8_t errMsg = msg.readUInt8("result code"); + // Successful pass change + if (errMsg == 1) + { + client->setState(STATE_CHANGEPASSWORD_SUCCESS); + } + // pass change failed + else + { + switch (errMsg) + { + case 0: + errorMessage = + // TRANSLATORS: error message + _("Account was not found. Please re-login."); + break; + case 2: + // TRANSLATORS: error message + errorMessage = _("Old password incorrect."); + break; + case 3: + // TRANSLATORS: error message + errorMessage = _("New password too short."); + break; + default: + // TRANSLATORS: error message + errorMessage = _("Unknown error."); + break; + } + client->setState(STATE_ACCOUNTCHANGE_ERROR); + } +} + } // namespace TmwAthena diff --git a/src/net/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h index f6565d3e3..350d4118d 100644 --- a/src/net/tmwa/loginhandler.h +++ b/src/net/tmwa/loginhandler.h @@ -63,8 +63,6 @@ class LoginHandler final : public MessageHandler, public Ea::LoginHandler void sendVersion() const override final; - static void processServerVersion(Net::MessageIn &msg); - static void requestUpdateHosts(); private: @@ -72,6 +70,10 @@ class LoginHandler final : public MessageHandler, public Ea::LoginHandler const std::string &restrict password, const std::string &restrict email) const override final; + + static void processServerVersion(Net::MessageIn &msg); + + static void processCharPasswordResponse(Net::MessageIn &msg); }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2