diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/loginhandler.cpp | 7 | ||||
-rw-r--r-- | src/net/ea/loginhandler.h | 3 | ||||
-rw-r--r-- | src/net/eathena/loginhandler.cpp | 3 | ||||
-rw-r--r-- | src/net/eathena/loginhandler.h | 3 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.cpp | 52 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.h | 6 | ||||
-rw-r--r-- | src/net/tmwa/protocol.h | 3 |
7 files changed, 56 insertions, 21 deletions
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index c00301c7a..ac4f0466c 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -70,7 +70,7 @@ void LoginHandler::loginAccount(LoginData *loginData) // with a different config. loginData->resetCharacterSlots(); - sendLoginRegister(loginData->username, loginData->password); + sendLoginRegister(loginData->username, loginData->password, ""); } } @@ -114,7 +114,7 @@ void LoginHandler::registerAccount(LoginData *loginData) break; } - sendLoginRegister(username, loginData->password); + sendLoginRegister(username, loginData->password, loginData->email); } Worlds LoginHandler::getWorlds() const @@ -261,6 +261,9 @@ void LoginHandler::processLoginError(Net::MessageIn &msg) case 10: errorMessage = _("Wrong name."); break; + case 11: + errorMessage = _("Incorrect email."); + break; case 99: errorMessage = _("Username permanently erased."); break; diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h index eebe73ad5..89e6e1c47 100644 --- a/src/net/ea/loginhandler.h +++ b/src/net/ea/loginhandler.h @@ -91,7 +91,8 @@ class LoginHandler : public Net::LoginHandler protected: virtual void sendLoginRegister(const std::string &username, - const std::string &password) = 0; + const std::string &password, + const std::string &email) = 0; bool mVersionResponse; bool mRegistrationEnabled; diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp index 21da4ba9f..a8d5398c1 100644 --- a/src/net/eathena/loginhandler.cpp +++ b/src/net/eathena/loginhandler.cpp @@ -129,7 +129,8 @@ void LoginHandler::changePassword(const std::string &username A_UNUSED, } void LoginHandler::sendLoginRegister(const std::string &username, - const std::string &password) + const std::string &password, + const std::string &email) { MessageOut outMsg(0x0064); outMsg.writeInt32(0); // client version diff --git a/src/net/eathena/loginhandler.h b/src/net/eathena/loginhandler.h index 2b683f044..b6787939c 100644 --- a/src/net/eathena/loginhandler.h +++ b/src/net/eathena/loginhandler.h @@ -73,7 +73,8 @@ class LoginHandler final : public MessageHandler, public Ea::LoginHandler private: void sendLoginRegister(const std::string &username, - const std::string &password); + const std::string &password, + const std::string &email); }; } // namespace EAthena diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 7e4eca95f..6a3c95b96 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -131,20 +131,40 @@ void LoginHandler::changePassword(const std::string &username A_UNUSED, } void LoginHandler::sendLoginRegister(const std::string &username, - const std::string &password) + const std::string &password, + const std::string &email) { - MessageOut outMsg(0x0064); - outMsg.writeInt32(0); // client version - outMsg.writeString(username, 24); - outMsg.writeStringNoLog(password, 24); - - /* - * eAthena calls the last byte "client version 2", but it isn't used at - * at all. We're retasking it, as a bit mask: - * 0 - can handle the 0x63 "update host" packet - * 1 - defaults to the first char-server (instead of the last) - */ - outMsg.writeInt8(0x03); + if (email.empty()) + { + MessageOut outMsg(CMSG_LOGIN_REGISTER); + outMsg.writeInt32(0); // client version + outMsg.writeString(username, 24); + outMsg.writeStringNoLog(password, 24); + + /* + * eAthena calls the last byte "client version 2", but it isn't used at + * at all. We're retasking it, as a bit mask: + * 0 - can handle the 0x63 "update host" packet + * 1 - defaults to the first char-server (instead of the last) + */ + outMsg.writeInt8(0x03); + } + else + { + MessageOut outMsg(CMSG_LOGIN_REGISTER2); + outMsg.writeInt32(0); // client version + outMsg.writeString(username, 24); + outMsg.writeStringNoLog(password, 24); + + /* + * eAthena calls the last byte "client version 2", but it isn't used at + * at all. We're retasking it, as a bit mask: + * 0 - can handle the 0x63 "update host" packet + * 1 - defaults to the first char-server (instead of the last) + */ + outMsg.writeInt8(0x03); + outMsg.writeString(email, 24); + } } ServerInfo *LoginHandler::getCharServer() @@ -217,4 +237,10 @@ void LoginHandler::processUpdateHost2(Net::MessageIn &msg) Client::setState(STATE_LOGIN); } +int LoginHandler::supportedOptionalActions() const +{ + return serverVersion >= 7 ? SetEmailOnRegister | SetGenderOnRegister + : SetGenderOnRegister; +} + } // namespace TmwAthena diff --git a/src/net/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h index 1a78fbb59..004612f21 100644 --- a/src/net/tmwa/loginhandler.h +++ b/src/net/tmwa/loginhandler.h @@ -53,8 +53,7 @@ class LoginHandler final : public MessageHandler, public Ea::LoginHandler void disconnect(); - int supportedOptionalActions() const A_WARN_UNUSED - { return SetGenderOnRegister; } + int supportedOptionalActions() const A_WARN_UNUSED; unsigned int getMaxPasswordLength() const A_WARN_UNUSED { return 25; } @@ -73,7 +72,8 @@ class LoginHandler final : public MessageHandler, public Ea::LoginHandler private: void sendLoginRegister(const std::string &username, - const std::string &password); + const std::string &password, + const std::string &email); }; } // namespace TmwAthena diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h index 72540c54b..a5606cea7 100644 --- a/src/net/tmwa/protocol.h +++ b/src/net/tmwa/protocol.h @@ -73,6 +73,9 @@ enum *********************************/ #define SMSG_SERVER_VERSION_RESPONSE 0x7531 +#define CMSG_LOGIN_REGISTER 0x0064 +#define CMSG_LOGIN_REGISTER2 0x01de + #define SMSG_SERVER_PING 0x007f /**< Contains server tick */ #define SMSG_CONNECTION_PROBLEM 0x0081 |