summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/loginhandler.cpp36
-rw-r--r--src/net/ea/network.cpp2
-rw-r--r--src/net/ea/protocol.h2
3 files changed, 38 insertions, 2 deletions
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index 31d2c020..8f66343f 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -46,6 +46,7 @@ LoginHandler::LoginHandler()
SMSG_UPDATE_HOST,
SMSG_LOGIN_DATA,
SMSG_LOGIN_ERROR,
+ SMSG_CHAR_PASSWORD_RESPONSE,
0
};
handledMessages = _messages;
@@ -58,6 +59,37 @@ void LoginHandler::handleMessage(MessageIn &msg)
switch (msg.getId())
{
+ case SMSG_CHAR_PASSWORD_RESPONSE:
+ {
+ // 0: acc not found, 1: success, 2: password mismatch, 3: pass too short
+ int errMsg = msg.readInt8();
+ // Successful pass change
+ if (errMsg == 1)
+ {
+ state = STATE_CHANGEPASSWORD;
+ }
+ // pass change failed
+ else
+ {
+ switch (errMsg) {
+ case 0:
+ errorMessage = _("Account not connected. Please login first.");
+ break;
+ case 2:
+ errorMessage = _("Old password incorrect");
+ break;
+ case 3:
+ errorMessage = _("New password too short");
+ break;
+ default:
+ errorMessage = _("Unknown error");
+ break;
+ }
+ state = STATE_ACCOUNTCHANGE_ERROR;
+ }
+ }
+ break;
+
case SMSG_UPDATE_HOST:
int len;
@@ -157,7 +189,9 @@ void LoginHandler::changePassword(const std::string &username,
const std::string &oldPassword,
const std::string &newPassword)
{
- // TODO
+ MessageOut outMsg(CMSG_CHAR_PASSWORD_CHANGE);
+ outMsg.writeString(oldPassword, 24);
+ outMsg.writeString(newPassword, 24);
}
void LoginHandler::chooseServer(int server)
diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp
index 7b731de3..956d7877 100644
--- a/src/net/ea/network.cpp
+++ b/src/net/ea/network.cpp
@@ -40,7 +40,7 @@ short packet_lengths[] = {
// #0x0040
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, -1, 55, 17, 3, 37, 46, -1, 23, -1, 3,108, 3, 2,
+ 0, 50, 3, -1, 55, 17, 3, 37, 46, -1, 23, -1, 3,108, 3, 2,
3, 28, 19, 11, 3, -1, 9, 5, 54, 53, 58, 60, 41, 2, 6, 6,
// #0x0080
7, 3, 2, 2, 2, 5, 16, 12, 10, 7, 29, 23, -1, -1, -1, 0,
diff --git a/src/net/ea/protocol.h b/src/net/ea/protocol.h
index 0373dd8a..f8caf4c1 100644
--- a/src/net/ea/protocol.h
+++ b/src/net/ea/protocol.h
@@ -42,6 +42,7 @@ static const int STORAGE_OFFSET = 1;
#define SMSG_CHAR_DELETE_SUCCEEDED 0x006f
#define SMSG_CHAR_DELETE_FAILED 0x0070
#define SMSG_CHAR_MAP_INFO 0x0071
+#define SMSG_CHAR_PASSWORD_RESPONSE 0x0062 /**< Custom packet reply to password change request */
#define SMSG_MAP_LOGIN_SUCCESS 0x0073 /**< Contains starting location */
#define SMSG_PLAYER_UPDATE_1 0x01d8
@@ -140,6 +141,7 @@ static const int STORAGE_OFFSET = 1;
/**********************************
* Packets from client to server *
**********************************/
+#define CMSG_CHAR_PASSWORD_CHANGE 0x0061 /**< Custom change password packet */
#define CMSG_CHAR_SERVER_CONNECT 0x0065
#define CMSG_CHAR_SELECT 0x0066
#define CMSG_CHAR_CREATE 0x0067