diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-08-02 09:43:57 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-08-02 09:43:57 +0000 |
commit | 25fe73f89756cb4102f97bcccdb8635a6a56f35d (patch) | |
tree | 12f6737acba4927f49f7d7b676467fe301a2a430 /src/net/loginhandler.cpp | |
parent | 2ae843719c2a7b2325309404a0e3cbb4aeb9c3df (diff) | |
download | mana-25fe73f89756cb4102f97bcccdb8635a6a56f35d.tar.gz mana-25fe73f89756cb4102f97bcccdb8635a6a56f35d.tar.bz2 mana-25fe73f89756cb4102f97bcccdb8635a6a56f35d.tar.xz mana-25fe73f89756cb4102f97bcccdb8635a6a56f35d.zip |
Ported account registration to tmwserv. There's still a disconnection/reconnection between registration and login.
Diffstat (limited to 'src/net/loginhandler.cpp')
-rw-r--r-- | src/net/loginhandler.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/net/loginhandler.cpp b/src/net/loginhandler.cpp index 5b8fbd1f..ebc8f535 100644 --- a/src/net/loginhandler.cpp +++ b/src/net/loginhandler.cpp @@ -36,6 +36,7 @@ LoginHandler::LoginHandler() { static const Uint16 _messages[] = { APMSG_LOGIN_RESPONSE, + APMSG_REGISTER_RESPONSE, 0 }; handledMessages = _messages; @@ -46,6 +47,7 @@ void LoginHandler::handleMessage(MessageIn *msg) switch (msg->getId()) { case APMSG_LOGIN_RESPONSE: + { int errMsg = msg->readByte(); // Successful login if (errMsg == ERRMSG_OK) @@ -90,6 +92,38 @@ void LoginHandler::handleMessage(MessageIn *msg) } state = ERROR_STATE; } + } + break; + case APMSG_REGISTER_RESPONSE: + { + int errMsg = msg->readByte(); + // Successful registration + if (errMsg == ERRMSG_OK) + { + state = ACCOUNT_STATE; + } + // Registration failed + else { + switch (errMsg) { + case REGISTER_INVALID_VERSION: + errorMessage = "Client has an insufficient version number to login."; + break; + case ERRMSG_INVALID_ARGUMENT: + errorMessage = "Wrong username, password or email address"; + break; + case REGISTER_EXISTS_USERNAME: + errorMessage = "Username already exists"; + break; + case REGISTER_EXISTS_EMAIL: + errorMessage = "Email address already exists"; + break; + default: + errorMessage = "Unknown error"; + break; + } + state = ERROR_STATE; + } + } break; } } |