diff options
| author | Shauren <shauren.trinity@gmail.com> | 2023-11-21 12:25:22 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2023-12-02 15:57:03 +0100 |
| commit | 45a5b6a9f04d2f605e7141b8da6e9cfa24711e07 (patch) | |
| tree | 5d0f5890d888610ad4cf598db9c47e831a41eb35 /src/server/authserver/Server | |
| parent | 9daaa99ed49fc4ed63007bc932a411d33b5b7ef8 (diff) | |
Core/Calendar: Implement different timezone support for ingame calendar
Closes #8390
Closes #29427
(cherry picked from commit b888b1b09f71a8b8b4a9d45c804a1f164fb65ac3)
Diffstat (limited to 'src/server/authserver/Server')
| -rw-r--r-- | src/server/authserver/Server/AuthSession.cpp | 21 | ||||
| -rw-r--r-- | src/server/authserver/Server/AuthSession.h | 9 |
2 files changed, 17 insertions, 13 deletions
diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp index d9058b3392a..ba2ef766ac7 100644 --- a/src/server/authserver/Server/AuthSession.cpp +++ b/src/server/authserver/Server/AuthSession.cpp @@ -18,21 +18,19 @@ #include "AuthSession.h" #include "AES.h" #include "AuthCodes.h" +#include "ByteBuffer.h" #include "Config.h" #include "CryptoGenerics.h" +#include "CryptoHash.h" #include "CryptoRandom.h" #include "DatabaseEnv.h" -#include "Errors.h" -#include "CryptoHash.h" #include "IPLocation.h" #include "Log.h" #include "RealmList.h" #include "SecretMgr.h" -#include "Timer.h" #include "TOTP.h" #include "Util.h" #include <boost/lexical_cast.hpp> -#include <openssl/crypto.h> using boost::asio::ip::tcp; @@ -161,7 +159,7 @@ void AccountInfo::LoadResult(Field* fields) } AuthSession::AuthSession(tcp::socket&& socket) : Socket(std::move(socket)), -_status(STATUS_CHALLENGE), _build(0), _expversion(0) { } +_status(STATUS_CHALLENGE), _build(0), _timezoneOffset(0min), _expversion(0) { } void AuthSession::Start() { @@ -300,11 +298,14 @@ bool AuthSession::HandleLogonChallenge() for (int i = 0; i < 4; ++i) _localizationName[i] = challenge->country[4 - i - 1]; + _timezoneOffset = Minutes(challenge->timezone_bias); + // Get the account details from the account table LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGONCHALLENGE); stmt->setString(0, login); - _queryProcessor.AddCallback(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&AuthSession::LogonChallengeCallback, this, std::placeholders::_1))); + _queryProcessor.AddCallback(LoginDatabase.AsyncQuery(stmt) + .WithPreparedCallback([this](PreparedQueryResult result) { LogonChallengeCallback(std::move(result)); })); return true; } @@ -513,7 +514,8 @@ bool AuthSession::HandleLogonProof() stmt->setString(1, address); stmt->setUInt32(2, GetLocaleByName(_localizationName)); stmt->setString(3, _os); - stmt->setString(4, _accountInfo.Login); + stmt->setInt16(4, _timezoneOffset.count()); + stmt->setString(5, _accountInfo.Login); LoginDatabase.DirectExecute(stmt); // Finish SRP6 and send the final result to the client @@ -636,11 +638,14 @@ bool AuthSession::HandleReconnectChallenge() for (int i = 0; i < 4; ++i) _localizationName[i] = challenge->country[4 - i - 1]; + _timezoneOffset = Minutes(challenge->timezone_bias); + // Get the account details from the account table LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_RECONNECTCHALLENGE); stmt->setString(0, login); - _queryProcessor.AddCallback(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&AuthSession::ReconnectChallengeCallback, this, std::placeholders::_1))); + _queryProcessor.AddCallback(LoginDatabase.AsyncQuery(stmt) + .WithPreparedCallback([this](PreparedQueryResult result) { ReconnectChallengeCallback(std::move(result)); })); return true; } diff --git a/src/server/authserver/Server/AuthSession.h b/src/server/authserver/Server/AuthSession.h index 71af8272501..844de0ed787 100644 --- a/src/server/authserver/Server/AuthSession.h +++ b/src/server/authserver/Server/AuthSession.h @@ -19,20 +19,18 @@ #define __AUTHSESSION_H__ #include "AsyncCallbackProcessor.h" -#include "BigNumber.h" -#include "ByteBuffer.h" #include "Common.h" #include "CryptoHash.h" +#include "DatabaseEnvFwd.h" +#include "Duration.h" #include "Optional.h" #include "Socket.h" #include "SRP6.h" -#include "QueryResult.h" -#include <memory> #include <boost/asio/ip/tcp.hpp> using boost::asio::ip::tcp; -class Field; +class ByteBuffer; struct AuthHandler; enum AuthStatus @@ -102,6 +100,7 @@ private: std::string _os; std::string _ipCountry; uint16 _build; + Minutes _timezoneOffset; uint8 _expversion; QueryCallbackProcessor _queryProcessor; |
