diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-04-09 16:51:26 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-04-09 20:21:21 -0600 |
commit | 9d94337026bbe6236bc4a39143c839a3bb386326 (patch) | |
tree | dac05e0eb05abd5476f735f55cb94921b96280da | |
parent | c8b0e10348ea28da418985c997b324cfce865064 (diff) | |
download | mana-9d94337026bbe6236bc4a39143c839a3bb386326.tar.gz mana-9d94337026bbe6236bc4a39143c839a3bb386326.tar.bz2 mana-9d94337026bbe6236bc4a39143c839a3bb386326.tar.xz mana-9d94337026bbe6236bc4a39143c839a3bb386326.zip |
Add support for registration disabled for eAthena
Reviewed-by: Chuck Miller`
-rw-r--r-- | src/gui/login.cpp | 3 | ||||
-rw-r--r-- | src/net/ea/loginhandler.cpp | 19 | ||||
-rw-r--r-- | src/net/ea/loginhandler.h | 3 | ||||
-rw-r--r-- | src/net/loginhandler.h | 2 | ||||
-rw-r--r-- | src/net/manaserv/loginhandler.cpp | 5 | ||||
-rw-r--r-- | src/net/manaserv/loginhandler.h | 2 |
6 files changed, 30 insertions, 4 deletions
diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 78914475..bfad5c32 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -36,6 +36,8 @@ #include "gui/widgets/textfield.h" #include "net/logindata.h" +#include "net/loginhandler.h" +#include "net/net.h" #include "utils/gettext.h" #include "utils/stringutils.h" @@ -89,6 +91,7 @@ LoginDialog::LoginDialog(LoginData *loginData): mPassField->requestFocus(); mLoginButton->setEnabled(canSubmit()); + mRegisterButton->setEnabled(Net::getLoginHandler()->isRegistrationEnabled()); } LoginDialog::~LoginDialog() diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 730535b8..42ba0c61 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -41,7 +41,8 @@ namespace EAthena { extern ServerInfo charServer; -LoginHandler::LoginHandler() +LoginHandler::LoginHandler(): + mRegistrationEnabled(true) { static const Uint16 _messages[] = { SMSG_UPDATE_HOST, @@ -190,9 +191,14 @@ void LoginHandler::handleMessage(Net::MessageIn &msg) msg.readInt8(); // T msg.readInt8(); // M msg.readInt8(); // W - msg.readInt8(); // (space) - msg.readInt8(); // e - msg.readInt8(); // A + + unsigned int options = msg.readInt32(); + + if (options & 1) + { + // Registeration not allowed + mRegistrationEnabled = false; + } //state = STATE_LOGIN; } @@ -217,6 +223,11 @@ void LoginHandler::disconnect() mNetwork->disconnect(); } +bool LoginHandler::isRegistrationEnabled() +{ + return mRegistrationEnabled; +} + void LoginHandler::getRegistrationDetails() { // Not supported, so move on diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h index 4e31e64c..1dd4f52c 100644 --- a/src/net/ea/loginhandler.h +++ b/src/net/ea/loginhandler.h @@ -51,6 +51,8 @@ class LoginHandler : public MessageHandler, public Net::LoginHandler int supportedOptionalActions() const { return SetGenderOnRegister; } + bool isRegistrationEnabled(); + void getRegistrationDetails(); unsigned int getMaxPasswordLength() const { return 25; } @@ -81,6 +83,7 @@ class LoginHandler : public MessageHandler, public Net::LoginHandler void sendLoginRegister(const std::string &username, const std::string &password); + bool mRegistrationEnabled; std::string mUpdateHost; Worlds mWorlds; Token mToken; diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h index 0ac9d086..9291f2b2 100644 --- a/src/net/loginhandler.h +++ b/src/net/loginhandler.h @@ -63,6 +63,8 @@ class LoginHandler */ virtual int supportedOptionalActions() const = 0; + virtual bool isRegistrationEnabled() = 0; + virtual void getRegistrationDetails() = 0; virtual unsigned int getMinUserNameLength() const { return 4; } diff --git a/src/net/manaserv/loginhandler.cpp b/src/net/manaserv/loginhandler.cpp index b3c70226..e51aef6f 100644 --- a/src/net/manaserv/loginhandler.cpp +++ b/src/net/manaserv/loginhandler.cpp @@ -354,6 +354,11 @@ void LoginHandler::disconnect() } } +bool LoginHandler::isRegistrationEnabled() +{ + return true; +} + void LoginHandler::getRegistrationDetails() { MessageOut msg(PAMSG_REQUEST_REGISTER_INFO); diff --git a/src/net/manaserv/loginhandler.h b/src/net/manaserv/loginhandler.h index 6416ff29..d2ffbc3d 100644 --- a/src/net/manaserv/loginhandler.h +++ b/src/net/manaserv/loginhandler.h @@ -47,6 +47,8 @@ class LoginHandler : public MessageHandler, public Net::LoginHandler int supportedOptionalActions() const { return Unregister | ChangeEmail | SetEmailOnRegister; } + bool isRegistrationEnabled(); + void getRegistrationDetails(); unsigned int getMinUserNameLength() const; |