diff options
| author | Shauren <shauren.trinity@gmail.com> | 2015-10-06 00:30:47 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2015-10-06 00:30:47 +0200 |
| commit | 63def8aa3291d0a6e5f83b289ad12c4c8a3cebd9 (patch) | |
| tree | cfb5fe68515b5421c0719430f3689733bde20429 /src/server/bnetserver/Server | |
| parent | 2c828a47a5aa03c850f0a0fdf7c2100771f69ef8 (diff) | |
Core/Battle.net:
* Changed packet structures to mirror client names
* Simplified ToString Building
* Removed deprecated structures
World: Cleaned up duplicate realm info 'realm' and 'realmHandle' variables (realmHandle was removed, that data is fully contained in realm)
Diffstat (limited to 'src/server/bnetserver/Server')
| -rw-r--r-- | src/server/bnetserver/Server/ComponentManager.cpp | 20 | ||||
| -rw-r--r-- | src/server/bnetserver/Server/ComponentManager.h | 12 | ||||
| -rw-r--r-- | src/server/bnetserver/Server/ModuleManager.cpp | 12 | ||||
| -rw-r--r-- | src/server/bnetserver/Server/ModuleManager.h | 24 | ||||
| -rw-r--r-- | src/server/bnetserver/Server/Session.cpp | 154 | ||||
| -rw-r--r-- | src/server/bnetserver/Server/Session.h | 3 |
6 files changed, 109 insertions, 116 deletions
diff --git a/src/server/bnetserver/Server/ComponentManager.cpp b/src/server/bnetserver/Server/ComponentManager.cpp index 52f93fd52ad..468b03bf13b 100644 --- a/src/server/bnetserver/Server/ComponentManager.cpp +++ b/src/server/bnetserver/Server/ComponentManager.cpp @@ -20,7 +20,7 @@ Battlenet::ComponentMgr::~ComponentMgr() { - for (Component* component : _components) + for (Version::Record* component : _components) delete component; } @@ -32,23 +32,23 @@ void Battlenet::ComponentMgr::Load() do { Field* fields = result->Fetch(); - Component* component = new Component(); - component->Program = fields[0].GetString(); - component->Platform = fields[1].GetString(); - component->Build = fields[2].GetUInt32(); + Version::Record* component = new Version::Record(); + component->ProgramId = fields[0].GetString(); + component->Component = fields[1].GetString(); + component->Version = fields[2].GetUInt32(); _components.insert(component); - _programs.insert(component->Program); - _platforms.insert(component->Platform); + _programs.insert(component->ProgramId); + _platforms.insert(component->Component); } while (result->NextRow()); } } -bool Battlenet::ComponentMgr::HasComponent(Battlenet::Component const* component) const +bool Battlenet::ComponentMgr::HasComponent(Battlenet::Version::Record const* component) const { - for (Component const* c : _components) - if (component->Program == c->Program && component->Platform == c->Platform && component->Build == c->Build) + for (Version::Record const* c : _components) + if (component->ProgramId == c->ProgramId && component->Component == c->Component && component->Version == c->Version) return true; return false; diff --git a/src/server/bnetserver/Server/ComponentManager.h b/src/server/bnetserver/Server/ComponentManager.h index 7aae45d94c5..0b403d2f309 100644 --- a/src/server/bnetserver/Server/ComponentManager.h +++ b/src/server/bnetserver/Server/ComponentManager.h @@ -19,19 +19,13 @@ #define ComponentManager_h__ #include "Define.h" +#include "PacketsCommon.h" #include <cstring> #include <string> #include <set> namespace Battlenet { - struct Component - { - std::string Program; - std::string Platform; - uint32 Build; - }; - class ComponentMgr { ComponentMgr() { } @@ -39,7 +33,7 @@ namespace Battlenet public: void Load(); - bool HasComponent(Component const* component) const; + bool HasComponent(Version::Record const* component) const; bool HasProgram(std::string const& program) const { return _programs.count(program) != 0; } bool HasPlatform(std::string const& platform) const { return _platforms.count(platform) != 0; } @@ -50,7 +44,7 @@ namespace Battlenet } private: - std::set<Component*> _components; + std::set<Version::Record*> _components; std::set<std::string> _programs; std::set<std::string> _platforms; }; diff --git a/src/server/bnetserver/Server/ModuleManager.cpp b/src/server/bnetserver/Server/ModuleManager.cpp index 3b525eae094..04d21c191a2 100644 --- a/src/server/bnetserver/Server/ModuleManager.cpp +++ b/src/server/bnetserver/Server/ModuleManager.cpp @@ -33,8 +33,8 @@ void Battlenet::ModuleManager::Load() { Field* fields = result->Fetch(); ModuleInfo* module = new ModuleInfo(); - module->Type = fields[2].GetString(); - HexStrToByteArray(fields[0].GetString(), module->ModuleId); + module->Handle.Type = fields[2].GetString(); + HexStrToByteArray(fields[0].GetString(), module->Handle.ModuleId); std::string data = fields[4].GetString(); module->DataSize = data.length() / 2; if (module->DataSize) @@ -56,3 +56,11 @@ Battlenet::ModuleInfo* Battlenet::ModuleManager::CreateModule(std::string const& return new ModuleInfo(*_modules.at(key)); } + +std::string Battlenet::ModuleInfo::ToString() const +{ + std::ostringstream stream; + stream << "Battlenet::ModuleInput" << std::endl; + APPEND_FIELD(stream, Handle); + return stream.str(); +} diff --git a/src/server/bnetserver/Server/ModuleManager.h b/src/server/bnetserver/Server/ModuleManager.h index 68d5b2a1e78..ecd24a07363 100644 --- a/src/server/bnetserver/Server/ModuleManager.h +++ b/src/server/bnetserver/Server/ModuleManager.h @@ -18,10 +18,7 @@ #ifndef ModuleManager_h__ #define ModuleManager_h__ -#include "Define.h" -#include <cstring> -#include <string> -#include <map> +#include "PacketsCommon.h" namespace Battlenet { @@ -42,12 +39,14 @@ namespace Battlenet } }; - struct ModuleInfo + struct ModuleInfo : public PrintableComponent { - ModuleInfo() : Region("EU"), DataSize(0), Data(nullptr) { } - ModuleInfo(ModuleInfo const& right) : Type(right.Type), Region(right.Region), DataSize(right.DataSize), Data(nullptr) + ModuleInfo() : DataSize(0), Data(nullptr) { Handle.Region = "EU"; } + ModuleInfo(ModuleInfo const& right) : DataSize(right.DataSize), Data(nullptr) { - memcpy(ModuleId, right.ModuleId, 32); + Handle.Type = right.Handle.Type; + Handle.Region = right.Handle.Region; + memcpy(Handle.ModuleId, right.Handle.ModuleId, 32); if (DataSize) { Data = new uint8[DataSize]; @@ -60,11 +59,11 @@ namespace Battlenet delete[] Data; } - std::string Type; - std::string Region; - uint8 ModuleId[32]; + Cache::Handle Handle; uint32 DataSize; uint8* Data; + + std::string ToString() const override; }; class ModuleManager @@ -83,9 +82,6 @@ namespace Battlenet } private: - void LoadComponents(); - void LoadModules(); - std::map<ModuleKey, ModuleInfo*> _modules; }; } diff --git a/src/server/bnetserver/Server/Session.cpp b/src/server/bnetserver/Server/Session.cpp index 25c50ba867b..36137b20b41 100644 --- a/src/server/bnetserver/Server/Session.cpp +++ b/src/server/bnetserver/Server/Session.cpp @@ -136,69 +136,69 @@ void Battlenet::Session::HandleLogonRequest(Authentication::LogonRequest3 const& return; } - if (logonRequest.Program != "WoW") + if (logonRequest.Common.Program != "WoW") { Authentication::LogonResponse* logonResponse = new Authentication::LogonResponse(); logonResponse->SetAuthResult(AUTH_INVALID_PROGRAM); AsyncWrite(logonResponse); - TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s attempted to log in with game other than WoW (using %s)!", GetClientInfo().c_str(), logonRequest.Program.c_str()); + TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s attempted to log in with game other than WoW (using %s)!", GetClientInfo().c_str(), logonRequest.Common.Program.c_str()); return; } - if (!sComponentMgr->HasPlatform(logonRequest.Platform)) + if (!sComponentMgr->HasPlatform(logonRequest.Common.Platform)) { Authentication::LogonResponse* logonResponse = new Authentication::LogonResponse(); logonResponse->SetAuthResult(AUTH_INVALID_OS); AsyncWrite(logonResponse); - TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s attempted to log in from an unsupported platform (using %s)!", GetClientInfo().c_str(), logonRequest.Platform.c_str()); + TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s attempted to log in from an unsupported platform (using %s)!", GetClientInfo().c_str(), logonRequest.Common.Platform.c_str()); return; } - if (!sComponentMgr->HasPlatform(logonRequest.Locale)) + if (!sComponentMgr->HasPlatform(logonRequest.Common.Locale)) { Authentication::LogonResponse* logonResponse = new Authentication::LogonResponse(); logonResponse->SetAuthResult(AUTH_UNSUPPORTED_LANGUAGE); AsyncWrite(logonResponse); - TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s attempted to log in with unsupported locale (using %s)!", GetClientInfo().c_str(), logonRequest.Locale.c_str()); + TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s attempted to log in with unsupported locale (using %s)!", GetClientInfo().c_str(), logonRequest.Common.Locale.c_str()); return; } - for (Component const& component : logonRequest.Components) + for (Version::Record const& component : logonRequest.Common.Versions) { if (!sComponentMgr->HasComponent(&component)) { Authentication::LogonResponse* logonResponse = new Authentication::LogonResponse(); - if (!sComponentMgr->HasProgram(component.Program)) + if (!sComponentMgr->HasProgram(component.ProgramId)) { logonResponse->SetAuthResult(AUTH_INVALID_PROGRAM); - TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s is using unsupported component program %s!", GetClientInfo().c_str(), component.Program.c_str()); + TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s is using unsupported component program %s!", GetClientInfo().c_str(), component.ProgramId.c_str()); } - else if (!sComponentMgr->HasPlatform(component.Platform)) + else if (!sComponentMgr->HasPlatform(component.Component)) { logonResponse->SetAuthResult(AUTH_INVALID_OS); - TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s is using unsupported component platform %s!", GetClientInfo().c_str(), component.Platform.c_str()); + TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s is using unsupported component platform %s!", GetClientInfo().c_str(), component.Component.c_str()); } else { - if (component.Program != "WoW" || AuthHelper::IsBuildSupportingBattlenet(component.Build)) + if (component.ProgramId != "WoW" || AuthHelper::IsBuildSupportingBattlenet(component.Version)) logonResponse->SetAuthResult(AUTH_REGION_BAD_VERSION); else logonResponse->SetAuthResult(AUTH_USE_GRUNT_LOGON); - TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s is using unsupported component version %u!", GetClientInfo().c_str(), component.Build); + TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s is using unsupported component version %u!", GetClientInfo().c_str(), component.Version); } AsyncWrite(logonResponse); return; } - if (component.Platform == "base") - _build = component.Build; + if (component.Component == "base") + _build = component.Version; } - std::string login = logonRequest.Login; - _locale = logonRequest.Locale; - _os = logonRequest.Platform; + std::string login = logonRequest.Account; + _locale = logonRequest.Common.Locale; + _os = logonRequest.Common.Platform; Utf8ToUpperOnlyLatin(login); PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_ACCOUNT_INFO); @@ -341,12 +341,12 @@ void Battlenet::Session::HandleResumeRequest(Authentication::ResumeRequest const return; } - std::string login = resumeRequest.Login; - _locale = resumeRequest.Locale; - _os = resumeRequest.Platform; - auto baseComponent = std::find_if(resumeRequest.Components.begin(), resumeRequest.Components.end(), [](Component const& c) { return c.Program == "base"; }); - if (baseComponent != resumeRequest.Components.end()) - _build = baseComponent->Build; + std::string login = resumeRequest.Account; + _locale = resumeRequest.Common.Locale; + _os = resumeRequest.Common.Platform; + auto baseComponent = std::find_if(resumeRequest.Common.Versions.begin(), resumeRequest.Common.Versions.end(), [](Version::Record const& c) { return c.ProgramId == "base"; }); + if (baseComponent != resumeRequest.Common.Versions.end()) + _build = baseComponent->Version; Utf8ToUpperOnlyLatin(login); PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_RECONNECT_INFO); @@ -398,7 +398,7 @@ void Battlenet::Session::HandleResumeRequestCallback(PreparedQueryResult result) void Battlenet::Session::HandleProofResponse(Authentication::ProofResponse const& proofResponse) { - if (_modulesWaitingForData.size() < proofResponse.Modules.size()) + if (_modulesWaitingForData.size() < proofResponse.Response.size()) { Authentication::LogonResponse* complete = new Authentication::LogonResponse(); complete->SetAuthResult(AUTH_CORRUPTED_MODULE); @@ -407,9 +407,9 @@ void Battlenet::Session::HandleProofResponse(Authentication::ProofResponse const } ServerPacket* response = nullptr; - for (size_t i = 0; i < proofResponse.Modules.size(); ++i) + for (size_t i = 0; i < proofResponse.Response.size(); ++i) { - if (!(this->*(ModuleHandlers[_modulesWaitingForData.front()]))(proofResponse.Modules[i], &response)) + if (!(this->*(ModuleHandlers[_modulesWaitingForData.front()]))(proofResponse.Response[i], &response)) break; _modulesWaitingForData.pop(); @@ -469,17 +469,17 @@ void Battlenet::Session::HandleListSubscribeRequestCallback(PreparedQueryResult do { Field* fields = result->Fetch(); - uint32 build = fields[4].GetUInt32(); - listSubscribeResponse->CharacterCounts.push_back({ RealmId(fields[2].GetUInt8(), fields[3].GetUInt8(), fields[1].GetUInt32(), (_build != build ? build : 0)), fields[0].GetUInt8() }); + listSubscribeResponse->ToonCounts.emplace_back(PrintableRealmHandle(fields[2].GetUInt8(), fields[3].GetUInt8(), fields[1].GetUInt32()), uint16(fields[0].GetUInt8())); } while (result->NextRow()); } + AsyncWrite(listSubscribeResponse); + for (RealmList::RealmMap::value_type const& i : sRealmList->GetRealms()) - listSubscribeResponse->RealmData.push_back(BuildListUpdate(&i.second)); + AsyncWrite(BuildListUpdate(&i.second)); - listSubscribeResponse->RealmData.push_back(new WoWRealm::ListComplete()); + AsyncWrite(new WoWRealm::ListComplete()); - AsyncWrite(listSubscribeResponse); _subscribedToRealmListUpdates = true; } @@ -491,29 +491,29 @@ void Battlenet::Session::HandleListUnsubscribe(WoWRealm::ListUnsubscribe const& void Battlenet::Session::HandleJoinRequestV2(WoWRealm::JoinRequestV2 const& joinRequest) { WoWRealm::JoinResponseV2* joinResponse = new WoWRealm::JoinResponseV2(); - Realm const* realm = sRealmList->GetRealm(joinRequest.Realm); - if (!realm || realm->Flags & (REALM_FLAG_INVALID | REALM_FLAG_OFFLINE) || realm->Id.Build != _build) + Realm const* realm = sRealmList->GetRealm(joinRequest.Id); + if (!realm || realm->Flags & (REALM_FLAG_VERSION_MISMATCH | REALM_FLAG_OFFLINE) || realm->Build != _build) { - joinResponse->Response = WoWRealm::JoinResponseV2::FAILURE; + joinResponse->Type = WoWRealm::JoinResponseV2::FAILURE; AsyncWrite(joinResponse); return; } - joinResponse->ServerSeed = rand32(); + joinResponse->Success.ServerSalt = rand32(); uint8 sessionKey[40]; HmacSha1 hmac(K.GetNumBytes(), K.AsByteArray().get()); hmac.UpdateData((uint8*)"WoW\0", 4); - hmac.UpdateData((uint8*)&joinRequest.ClientSeed, 4); - hmac.UpdateData((uint8*)&joinResponse->ServerSeed, 4); + hmac.UpdateData((uint8*)&joinRequest.ClientSalt, 4); + hmac.UpdateData((uint8*)&joinResponse->Success.ServerSalt, 4); hmac.Finalize(); memcpy(sessionKey, hmac.GetDigest(), hmac.GetLength()); HmacSha1 hmac2(K.GetNumBytes(), K.AsByteArray().get()); hmac2.UpdateData((uint8*)"WoW\0", 4); - hmac2.UpdateData((uint8*)&joinResponse->ServerSeed, 4); - hmac2.UpdateData((uint8*)&joinRequest.ClientSeed, 4); + hmac2.UpdateData((uint8*)&joinResponse->Success.ServerSalt, 4); + hmac2.UpdateData((uint8*)&joinRequest.ClientSalt, 4); hmac2.Finalize(); memcpy(sessionKey + hmac.GetLength(), hmac2.GetDigest(), hmac2.GetLength()); @@ -521,25 +521,21 @@ void Battlenet::Session::HandleJoinRequestV2(WoWRealm::JoinRequestV2 const& join LoginDatabase.DirectPExecute("UPDATE account SET sessionkey = '%s', last_ip = '%s', last_login = NOW(), locale = %u, failed_logins = 0, os = '%s' WHERE id = %u", ByteArrayToHexStr(sessionKey, 40, true).c_str(), GetRemoteIpAddress().to_string().c_str(), GetLocaleByName(_locale), _os.c_str(), _gameAccountInfo->Id); - joinResponse->IPv4.push_back(realm->GetAddressForClient(GetRemoteIpAddress())); + joinResponse->Success.IPv4.push_back(realm->GetAddressForClient(GetRemoteIpAddress())); AsyncWrite(joinResponse); } -void Battlenet::Session::HandleSocialNetworkCheckConnected(Friends::SocialNetworkCheckConnected const& socialNetworkCheckConnected) -{ - Friends::SocialNetworkCheckConnectedResult* socialNetworkCheckConnectedResult = new Friends::SocialNetworkCheckConnectedResult(); - socialNetworkCheckConnectedResult->SocialNetworkId = socialNetworkCheckConnected.SocialNetworkId; - AsyncWrite(socialNetworkCheckConnectedResult); -} - void Battlenet::Session::HandleGetStreamItemsRequest(Cache::GetStreamItemsRequest const& getStreamItemsRequest) { - if (ModuleInfo* module = sModuleMgr->CreateModule(getStreamItemsRequest.Locale, getStreamItemsRequest.ItemName)) + if (getStreamItemsRequest.Stream.Type != Cache::GetStreamItemsRequest::StreamId::DESCRIPTION) + return; + + if (ModuleInfo* module = sModuleMgr->CreateModule(getStreamItemsRequest.Locale, getStreamItemsRequest.Stream.Description.ItemName)) { Cache::GetStreamItemsResponse* getStreamItemsResponse = new Cache::GetStreamItemsResponse(); - getStreamItemsResponse->Index = getStreamItemsRequest.Index; - getStreamItemsResponse->Modules.push_back(module); + getStreamItemsResponse->Token = getStreamItemsRequest.Token; + getStreamItemsResponse->Items.push_back(module); AsyncWrite(getStreamItemsResponse); } } @@ -570,11 +566,11 @@ void Battlenet::Session::ReadHandler() try { PacketHeader header; - header.Opcode = stream.Read<uint32>(6); + header.Command = stream.Read<uint32>(6); if (stream.Read<bool>(1)) header.Channel = stream.Read<int32>(4); - if (header.Channel != AUTHENTICATION && (header.Channel != CONNECTION || header.Opcode != Connection::CMSG_PING) && !_authed) + if (header.Channel != AUTHENTICATION && (header.Channel != CONNECTION || header.Command != Connection::CMSG_PING) && !_authed) { TC_LOG_DEBUG("session.packets", "%s Received not allowed %s. Client has not authed yet.", GetClientInfo().c_str(), header.ToString().c_str()); CloseSocket(); @@ -976,10 +972,10 @@ bool Battlenet::Session::HandleRiskFingerprintModule(BitStream* dataStream, Serv Authentication::LogonResponse* logonResponse = new Authentication::LogonResponse(); if (dataStream->Read<uint8>(8) == 1 && _accountInfo && _gameAccountInfo) { - logonResponse->AccountId = _accountInfo->Id; - logonResponse->GameAccountName = _gameAccountInfo->Name; - logonResponse->GameAccountFlags = GAMEACCOUNT_FLAG_PROPASS; - logonResponse->FailedLogins = _accountInfo->FailedLogins; + logonResponse->Result.Success.AccountId = _accountInfo->Id; + logonResponse->Result.Success.GameAccountName = _gameAccountInfo->Name; + logonResponse->Result.Success.GameAccountFlags = GAMEACCOUNT_FLAG_PROPASS; + logonResponse->Result.Success.LogonFailures = _accountInfo->FailedLogins; SQLTransaction trans = LoginDatabase.BeginTransaction(); @@ -1087,7 +1083,7 @@ bool Battlenet::Session::HandleResumeModule(BitStream* dataStream, ServerPacket* memcpy(resume->Data, resumeData.GetBuffer(), resume->DataSize); Authentication::ResumeResponse* resumeResponse = new Authentication::ResumeResponse(); - resumeResponse->Modules.push_back(resume); + resumeResponse->Result.Success.FinalRequest.push_back(resume); ReplaceResponse(response, resumeResponse); _authed = true; sSessionMgr.AddSession(this); @@ -1103,15 +1099,15 @@ bool Battlenet::Session::UnhandledModule(BitStream* /*dataStream*/, ServerPacket return false; } -void Battlenet::Session::UpdateRealms(std::vector<Realm const*>& realms, std::vector<RealmId>& deletedRealms) +void Battlenet::Session::UpdateRealms(std::vector<Realm const*>& realms, std::vector<RealmHandle>& deletedRealms) { for (Realm const* realm : realms) AsyncWrite(BuildListUpdate(realm)); - for (RealmId& deleted : deletedRealms) + for (RealmHandle& deleted : deletedRealms) { WoWRealm::ListUpdate* listUpdate = new WoWRealm::ListUpdate(); - listUpdate->UpdateState = WoWRealm::ListUpdate::DELETED; + listUpdate->State.Type = WoWRealm::ListUpdate::StateType::DELETED; listUpdate->Id = deleted; AsyncWrite(listUpdate); } @@ -1119,32 +1115,32 @@ void Battlenet::Session::UpdateRealms(std::vector<Realm const*>& realms, std::ve Battlenet::WoWRealm::ListUpdate* Battlenet::Session::BuildListUpdate(Realm const* realm) const { - uint32 flag = realm->Flags & ~REALM_FLAG_SPECIFYBUILD; - RealmBuildInfo const* buildInfo = AuthHelper::GetBuildInfo(realm->Id.Build); - if (realm->Id.Build != _build) - { - flag |= REALM_FLAG_INVALID; - if (buildInfo) - flag |= REALM_FLAG_SPECIFYBUILD; // tell the client what build the realm is for - } + uint32 flag = realm->Flags; + if (realm->Build != _build) + flag |= REALM_FLAG_VERSION_MISMATCH; WoWRealm::ListUpdate* listUpdate = new WoWRealm::ListUpdate(); - listUpdate->Timezone = realm->Timezone; - listUpdate->Population = realm->PopulationLevel; - listUpdate->Lock = (realm->AllowedSecurityLevel > _gameAccountInfo->SecurityLevel) ? 1 : 0; - listUpdate->Type = realm->Type; - listUpdate->Name = realm->Name; + listUpdate->State.Update.Category = realm->Timezone; + listUpdate->State.Update.Population = realm->PopulationLevel; + listUpdate->State.Update.StateFlags = (realm->AllowedSecurityLevel > _gameAccountInfo->SecurityLevel) ? 1 : 0; + listUpdate->State.Update.Type = realm->Type; + listUpdate->State.Update.Name = realm->Name; - if (flag & REALM_FLAG_SPECIFYBUILD) + if (_gameAccountInfo->SecurityLevel > SEC_PLAYER) { + listUpdate->State.Update.PrivilegedData = boost::in_place(); std::ostringstream version; - version << buildInfo->MajorVersion << '.' << buildInfo->MinorVersion << '.' << buildInfo->BugfixVersion << '.' << buildInfo->Build; + if (RealmBuildInfo const* buildInfo = AuthHelper::GetBuildInfo(realm->Build)) + version << buildInfo->MajorVersion << '.' << buildInfo->MinorVersion << '.' << buildInfo->BugfixVersion << '.' << buildInfo->Build; + else + version << "x.x.x." << realm->Build; - listUpdate->Version = version.str(); - listUpdate->Address = realm->GetAddressForClient(GetRemoteIpAddress()); + listUpdate->State.Update.PrivilegedData->Version = version.str(); + listUpdate->State.Update.PrivilegedData->ConfigId = realm->GetConfigId(); + listUpdate->State.Update.PrivilegedData->Address = realm->GetAddressForClient(GetRemoteIpAddress()); } - listUpdate->Flags = flag; + listUpdate->State.Update.InfoFlags = flag; listUpdate->Id = realm->Id; return listUpdate; } diff --git a/src/server/bnetserver/Server/Session.h b/src/server/bnetserver/Server/Session.h index 91890f9becb..6d5b97e85c9 100644 --- a/src/server/bnetserver/Server/Session.h +++ b/src/server/bnetserver/Server/Session.h @@ -106,7 +106,6 @@ namespace Battlenet void HandleJoinRequestV2(WoWRealm::JoinRequestV2 const& joinRequest); // Friends - void HandleSocialNetworkCheckConnected(Friends::SocialNetworkCheckConnected const& socialNetworkCheckConnected); // Cache void HandleGetStreamItemsRequest(Cache::GetStreamItemsRequest const& getStreamItemsRequest); @@ -114,7 +113,7 @@ namespace Battlenet void Start() override; bool Update() override; - void UpdateRealms(std::vector<Realm const*>& realms, std::vector<RealmId>& deletedRealms); + void UpdateRealms(std::vector<Realm const*>& realms, std::vector<RealmHandle>& deletedRealms); uint32 GetAccountId() const { return _accountInfo->Id; } uint32 GetGameAccountId() const { return _gameAccountInfo->Id; } |
