summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-17 22:43:13 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-17 22:43:13 +0300
commit73271c8b5e39d01c34064db8a4529e31d36cf0aa (patch)
tree62889d7fb733f0494317365d7846776b7371fcf7
parent9a40e1202946e3384500da28668a52d28ad377f4 (diff)
downloadmanaplus-73271c8b5e39d01c34064db8a4529e31d36cf0aa.tar.gz
manaplus-73271c8b5e39d01c34064db8a4529e31d36cf0aa.tar.bz2
manaplus-73271c8b5e39d01c34064db8a4529e31d36cf0aa.tar.xz
manaplus-73271c8b5e39d01c34064db8a4529e31d36cf0aa.zip
Add static in loginhandler.
-rw-r--r--src/net/ea/loginhandler.cpp23
-rw-r--r--src/net/ea/loginhandler.h22
-rw-r--r--src/net/eathena/loginhandler.cpp6
-rw-r--r--src/net/eathena/loginhandler.h4
-rw-r--r--src/net/tmwa/loginhandler.cpp4
-rw-r--r--src/net/tmwa/loginhandler.h4
6 files changed, 32 insertions, 31 deletions
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index 24c9d8e09..57eea9101 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -42,14 +42,19 @@
namespace Ea
{
+std::string LoginHandler::mUpdateHost;
+Worlds LoginHandler::mWorlds;
+Token LoginHandler::mToken;
+bool LoginHandler::mVersionResponse = false;
+bool LoginHandler::mRegistrationEnabled = true;
+
LoginHandler::LoginHandler() :
- Net::LoginHandler(),
- mVersionResponse(false),
- mRegistrationEnabled(true),
- mUpdateHost(),
- mWorlds(),
- mToken()
+ Net::LoginHandler()
{
+ mVersionResponse = false;
+ mRegistrationEnabled = true;
+ mUpdateHost.clear();
+ mWorlds.clear();
mToken.clear();
}
@@ -133,7 +138,7 @@ void LoginHandler::clearWorlds()
mWorlds.clear();
}
-void LoginHandler::procecessCharPasswordResponse(Net::MessageIn &msg) 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");
@@ -189,7 +194,7 @@ void LoginHandler::processLoginData(Net::MessageIn &msg)
{
msg.skip(2, "len");
- clearWorlds();
+ loginHandler->clearWorlds();
const int worldCount = (msg.getLength() - 47) / 32;
@@ -225,7 +230,7 @@ void LoginHandler::processLoginData(Net::MessageIn &msg)
client->setState(STATE_WORLD_SELECT);
}
-void LoginHandler::processLoginError(Net::MessageIn &msg) const
+void LoginHandler::processLoginError(Net::MessageIn &msg)
{
const uint8_t code = msg.readUInt8("error");
logger->log("Login::error code: %u", static_cast<unsigned int>(code));
diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h
index 6040e72fd..845e11f50 100644
--- a/src/net/ea/loginhandler.h
+++ b/src/net/ea/loginhandler.h
@@ -87,17 +87,13 @@ class LoginHandler notfinal : public Net::LoginHandler
const std::string &password)
const override final;
- virtual void procecessCharPasswordResponse(Net::MessageIn &msg) const;
+ static void processCharPasswordResponse(Net::MessageIn &msg);
- virtual void processUpdateHost(Net::MessageIn &msg);
+ static void processUpdateHost(Net::MessageIn &msg);
- virtual void processUpdateHost2(Net::MessageIn &msg) const = 0;
+ static void processLoginData(Net::MessageIn &msg);
- virtual void processLoginData(Net::MessageIn &msg);
-
- virtual void processLoginError(Net::MessageIn &msg) const;
-
- virtual void processServerVersion(Net::MessageIn &msg) = 0;
+ static void processLoginError(Net::MessageIn &msg);
void loginOrRegister(LoginData *const data) const override final;
@@ -108,11 +104,11 @@ class LoginHandler notfinal : public Net::LoginHandler
const std::string &password,
const std::string &email) const = 0;
- bool mVersionResponse;
- bool mRegistrationEnabled;
- std::string mUpdateHost;
- Worlds mWorlds;
- Token mToken;
+ static std::string mUpdateHost;
+ static Worlds mWorlds;
+ static Token mToken;
+ static bool mVersionResponse;
+ static bool mRegistrationEnabled;
};
} // namespace Ea
diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp
index f25b9a29c..ed05e2b07 100644
--- a/src/net/eathena/loginhandler.cpp
+++ b/src/net/eathena/loginhandler.cpp
@@ -67,7 +67,7 @@ void LoginHandler::handleMessage(Net::MessageIn &msg)
switch (msg.getId())
{
case SMSG_CHAR_PASSWORD_RESPONSE:
- procecessCharPasswordResponse(msg);
+ processCharPasswordResponse(msg);
break;
case SMSG_LOGIN_DATA:
@@ -146,7 +146,7 @@ ServerInfo *LoginHandler::getCharServer() const
return &charServer;
}
-void LoginHandler::processLoginError2(Net::MessageIn &msg) const
+void LoginHandler::processLoginError2(Net::MessageIn &msg)
{
const uint32_t code = msg.readInt32("error");
logger->log("Login::error code: %u", code);
@@ -220,7 +220,7 @@ void LoginHandler::processLoginError2(Net::MessageIn &msg) const
client->setState(STATE_ERROR);
}
-void LoginHandler::processUpdateHost2(Net::MessageIn &msg A_UNUSED) const
+void LoginHandler::processUpdateHost2(Net::MessageIn &msg A_UNUSED)
{
}
diff --git a/src/net/eathena/loginhandler.h b/src/net/eathena/loginhandler.h
index d9b69496b..eda2c809a 100644
--- a/src/net/eathena/loginhandler.h
+++ b/src/net/eathena/loginhandler.h
@@ -62,9 +62,9 @@ class LoginHandler final : public MessageHandler, public Ea::LoginHandler
ServerInfo *getCharServer() const override final A_WARN_UNUSED;
- void processLoginError2(Net::MessageIn &msg) const;
+ static void processLoginError2(Net::MessageIn &msg);
- void processUpdateHost2(Net::MessageIn &msg) const;
+ static void processUpdateHost2(Net::MessageIn &msg);
private:
void sendLoginRegister(const std::string &restrict username,
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index c58e7687e..75b5dba65 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -75,7 +75,7 @@ void LoginHandler::handleMessage(Net::MessageIn &msg)
switch (msg.getId())
{
case SMSG_CHAR_PASSWORD_RESPONSE:
- procecessCharPasswordResponse(msg);
+ processCharPasswordResponse(msg);
break;
case SMSG_UPDATE_HOST:
@@ -241,7 +241,7 @@ void LoginHandler::processServerVersion(Net::MessageIn &msg)
mVersionResponse = true;
}
-void LoginHandler::processUpdateHost2(Net::MessageIn &msg) const
+void LoginHandler::processUpdateHost2(Net::MessageIn &msg)
{
const int len = msg.readInt16("len") - 4;
const std::string updateHost = msg.readString(len, "host");
diff --git a/src/net/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h
index 632f02d62..e147bdc46 100644
--- a/src/net/tmwa/loginhandler.h
+++ b/src/net/tmwa/loginhandler.h
@@ -61,11 +61,11 @@ class LoginHandler final : public MessageHandler, public Ea::LoginHandler
ServerInfo *getCharServer() const override final A_WARN_UNUSED;
- void processServerVersion(Net::MessageIn &msg);
+ static void processServerVersion(Net::MessageIn &msg);
static void requestUpdateHosts();
- void processUpdateHost2(Net::MessageIn &msg) const;
+ static void processUpdateHost2(Net::MessageIn &msg);
private:
void sendLoginRegister(const std::string &restrict username,