2022-02-19 02:31:16 +01:00
|
|
|
#pragma once
|
2023-01-26 20:06:48 +01:00
|
|
|
#include "thirdparty/curl/include/curl/curl.h"
|
2023-04-28 23:47:58 +02:00
|
|
|
#include "bansystem.h"
|
2022-07-01 10:29:27 +02:00
|
|
|
#include "serverlisting.h"
|
2023-09-16 00:45:11 +02:00
|
|
|
#include "localize/ilocalize.h"
|
2022-02-19 02:31:16 +01:00
|
|
|
|
2022-07-01 10:29:27 +02:00
|
|
|
class CPylon
|
|
|
|
{
|
|
|
|
public:
|
2023-09-16 00:45:11 +02:00
|
|
|
CPylon() { m_Language = g_LanguageNames[0]; }
|
|
|
|
|
2023-04-24 01:55:37 +02:00
|
|
|
vector<NetGameServer_t> GetServerList(string& outMessage) const;
|
|
|
|
bool GetServerByToken(NetGameServer_t& slOutServer, string& outMessage, const string& svToken) const;
|
|
|
|
bool PostServerHost(string& outMessage, string& svOutToken, const NetGameServer_t& netGameServer) const;
|
2023-04-28 23:47:58 +02:00
|
|
|
|
2023-08-31 00:16:25 +02:00
|
|
|
bool GetBannedList(const CBanSystem::BannedList_t& inBannedVec, CBanSystem::BannedList_t& outBannedVec) const;
|
2023-04-29 00:05:47 +02:00
|
|
|
bool CheckForBan(const string& ipAddress, const uint64_t nucleusId, const string& personaName, string& outReason) const;
|
2023-04-24 01:55:37 +02:00
|
|
|
|
2023-09-07 11:17:05 +02:00
|
|
|
void ExtractError(const rapidjson::Document& resultBody, string& outMessage, CURLINFO status, const char* errorText = nullptr) const;
|
2023-04-24 01:55:37 +02:00
|
|
|
void ExtractError(const string& response, string& outMessage, CURLINFO status, const char* messageText = nullptr) const;
|
2023-04-24 00:32:27 +02:00
|
|
|
|
2023-09-07 11:17:05 +02:00
|
|
|
void LogBody(const rapidjson::Document& responseJson) const;
|
|
|
|
bool SendRequest(const char* endpoint, const rapidjson::Document& requestJson, rapidjson::Document& responseJson, string& outMessage, CURLINFO& status, const char* errorText = nullptr) const;
|
2023-04-25 00:45:39 +02:00
|
|
|
bool QueryServer(const char* endpoint, const char* request, string& outResponse, string& outMessage, CURLINFO& outStatus) const;
|
|
|
|
|
2023-07-19 02:17:28 +02:00
|
|
|
inline const string& GetCurrentToken() const { return m_Token; }
|
|
|
|
inline const string& GetCurrentError() const { return m_ErrorMsg; }
|
|
|
|
|
|
|
|
inline void SetCurrentToken(const string& token) { m_Token = token; }
|
|
|
|
inline void SetCurrentError(const string& error) { m_ErrorMsg = error; }
|
2023-02-04 19:18:18 +01:00
|
|
|
|
2023-08-17 20:22:28 +01:00
|
|
|
inline void SetLanguage(const char* lang) { m_Language = lang; };
|
|
|
|
|
2023-02-04 19:18:18 +01:00
|
|
|
private:
|
|
|
|
string m_Token;
|
|
|
|
string m_ErrorMsg;
|
2023-08-17 20:22:28 +01:00
|
|
|
const char* m_Language;
|
2022-07-01 10:29:27 +02:00
|
|
|
};
|
|
|
|
extern CPylon* g_pMasterServer;
|