From a8a3271470299820c5322523dc439415bc1ff8a0 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Sun, 22 May 2011 21:09:12 +0100 Subject: Added the ability to change your password (via pause menu) --HG-- extra : rebase_source : e8ec407f60711d42d33be4811b2880088f617b5b --- src/client.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index c85d6e9e2..5869dc77b 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1602,6 +1602,43 @@ void Client::sendChatMessage(const std::wstring &message) Send(0, data, true); } +void Client::sendChangePassword(const std::wstring oldpassword, + const std::wstring newpassword) +{ + Player *player = m_env.getLocalPlayer(); + if(player == NULL) + return; + + std::string playername = player->getName(); + std::string oldpwd = translatePassword(playername, oldpassword); + std::string newpwd = translatePassword(playername, newpassword); + + std::ostringstream os(std::ios_base::binary); + u8 buf[2+PASSWORD_SIZE*2]; + /* + [0] u16 TOSERVER_PASSWORD + [2] u8[28] old password + [30] u8[28] new password + */ + + writeU16(buf, TOSERVER_PASSWORD); + for(u32 i=0;i data((u8*)s.c_str(), s.size()); + // Send as reliable + Send(0, data, true); +} + + void Client::sendDamage(u8 damage) { DSTACK(__FUNCTION_NAME); -- cgit v1.2.3