diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-11-30 00:16:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-11-30 00:16:26 +0300 |
commit | e74bad91965068e4b91688a5c3df63bf6f2ca530 (patch) | |
tree | a1cf7b902ddb83ed9527e26bc6a0879e8bd130b7 /src/net/tmwa/loginhandler.cpp | |
parent | 13c2533f4a2d27f1c9156df2a8ad2851be2016fd (diff) | |
download | ManaVerse-e74bad91965068e4b91688a5c3df63bf6f2ca530.tar.gz ManaVerse-e74bad91965068e4b91688a5c3df63bf6f2ca530.tar.bz2 ManaVerse-e74bad91965068e4b91688a5c3df63bf6f2ca530.tar.xz ManaVerse-e74bad91965068e4b91688a5c3df63bf6f2ca530.zip |
Add support for email field in registration form.
Diffstat (limited to 'src/net/tmwa/loginhandler.cpp')
-rw-r--r-- | src/net/tmwa/loginhandler.cpp | 52 |
1 files changed, 39 insertions, 13 deletions
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 |