mirror of
https://github.com/SWG-Source/src.git
synced 2026-08-03 03:16:01 -04:00
Merge branch 'sbtc' into testing
This commit is contained in:
@@ -161,7 +161,7 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
|
||||
|
||||
StationId user_id;
|
||||
StationId parent_id;
|
||||
std::unordered_map<StationId, std::string> childAccounts;
|
||||
std::unordered_map<int, std::string> childAccounts;
|
||||
|
||||
if (!authURL.empty()) {
|
||||
// create the object
|
||||
@@ -184,8 +184,8 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
|
||||
childAccounts = api.getStringMap("subAccounts");
|
||||
|
||||
if (!ConfigLoginServer::getUseOldSuidGenerator()) {
|
||||
user_id = static_cast<StationId>(api.getNullableValue<StationId>("user_id"));
|
||||
parent_id = static_cast<StationId>(api.getNullableValue<StationId>("parent_id"));
|
||||
user_id = static_cast<StationId>(api.getNullableValue<int>("user_id"));
|
||||
parent_id = static_cast<StationId>(api.getNullableValue<int>("parent_id"));
|
||||
} else {
|
||||
if (parentAccount.length() > MAX_ACCOUNT_NAME_LENGTH) {
|
||||
parentAccount.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
|
||||
@@ -35,8 +35,8 @@ class CharacterNameLocator : public ObjectLocator
|
||||
DB::BindableLong character_station_id;
|
||||
DB::BindableString<127> character_name;
|
||||
DB::BindableString<127> character_full_name;
|
||||
DB::BindableInt64 character_create_time;
|
||||
DB::BindableInt64 character_last_login_time;
|
||||
DB::BindableLong character_create_time;
|
||||
DB::BindableLong character_last_login_time;
|
||||
};
|
||||
|
||||
class CharacterNameQuery : public DB::Query
|
||||
@@ -66,8 +66,8 @@ class CharacterNameLocator : public ObjectLocator
|
||||
std::vector<int> m_stationIds;
|
||||
std::vector<std::string> m_characterNames;
|
||||
std::vector<std::string> m_characterFullNames;
|
||||
std::vector<int64> m_characterCreateTime;
|
||||
std::vector<int64> m_characterLastLoginTime;
|
||||
std::vector<int> m_characterCreateTime;
|
||||
std::vector<int> m_characterLastLoginTime;
|
||||
};
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -224,15 +224,15 @@ void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::st
|
||||
std::vector<int> stationIds;
|
||||
std::vector<std::string> characterNames;
|
||||
std::vector<std::string> characterFullNames;
|
||||
std::vector<int64> characterCreateTimes;
|
||||
std::vector<int64> characterLastLoginTimes;
|
||||
std::vector<int> characterCreateTimes;
|
||||
std::vector<int> characterLastLoginTimes;
|
||||
|
||||
ids.push_back(id);
|
||||
stationIds.push_back(static_cast<int>(stationId));
|
||||
characterNames.push_back(normalizedName);
|
||||
characterFullNames.push_back(fullName);
|
||||
characterCreateTimes.push_back(static_cast<int64>(createTime));
|
||||
characterLastLoginTimes.push_back(static_cast<int64>(lastLoginTime));
|
||||
characterCreateTimes.push_back(static_cast<int>(createTime));
|
||||
characterLastLoginTimes.push_back(static_cast<int>(lastLoginTime));
|
||||
|
||||
ServerMessageForwarding::beginBroadcast();
|
||||
|
||||
@@ -316,24 +316,24 @@ const std::string & NameManager::getPlayerFullName(const NetworkId &id) const
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
int64 NameManager::getPlayerCreateTime(const NetworkId &id) const
|
||||
int NameManager::getPlayerCreateTime(const NetworkId &id) const
|
||||
{
|
||||
IdToCharacterDataMapType::const_iterator i=m_idToCharacterDataMap->find(id);
|
||||
if (i==m_idToCharacterDataMap->end())
|
||||
return -1;
|
||||
else
|
||||
return static_cast<int64>(i->second.createTime);
|
||||
return static_cast<int>(i->second.createTime);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
int64 NameManager::getPlayerLastLoginTime(const NetworkId &id) const
|
||||
int NameManager::getPlayerLastLoginTime(const NetworkId &id) const
|
||||
{
|
||||
IdToCharacterDataMapType::const_iterator i=m_idToCharacterDataMap->find(id);
|
||||
if (i==m_idToCharacterDataMap->end())
|
||||
return -1;
|
||||
else
|
||||
return static_cast<int64>(i->second.lastLoginTime);
|
||||
return static_cast<int>(i->second.lastLoginTime);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -464,7 +464,7 @@ void NameManager::releasePlayerName(const NetworkId &id)
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void NameManager::addPlayers(const std::vector<NetworkId> &ids, const std::vector<StationId> &stationIds, const std::vector<std::string> &names, const std::vector<std::string> &fullNames, const std::vector<int64> &createTimes, const std::vector<int64> &lastLoginTimes)
|
||||
void NameManager::addPlayers(const std::vector<NetworkId> &ids, const std::vector<int> &stationIds, const std::vector<std::string> &names, const std::vector<std::string> &fullNames, const std::vector<int> &createTimes, const std::vector<int> &lastLoginTimes)
|
||||
{
|
||||
DEBUG_FATAL(ids.size() != stationIds.size(),("Programmer bug: Vectors ids and stationIds must be the same size.\n"));
|
||||
DEBUG_FATAL(ids.size() != names.size(),("Programmer bug: Vectors ids and names must be the same size.\n"));
|
||||
@@ -486,8 +486,8 @@ void NameManager::sendAllNamesToServer (std::vector<uint32> const & servers) con
|
||||
std::vector<int> stationIds;
|
||||
std::vector<std::string> characterNames;
|
||||
std::vector<std::string> characterFullNames;
|
||||
std::vector<int64> characterCreateTimes;
|
||||
std::vector<int64> characterLastLoginTimes;
|
||||
std::vector<int> characterCreateTimes;
|
||||
std::vector<int> characterLastLoginTimes;
|
||||
|
||||
for (IdToCharacterDataMapType::const_iterator i=m_idToCharacterDataMap->begin(); i!=m_idToCharacterDataMap->end(); ++i)
|
||||
{
|
||||
@@ -495,8 +495,8 @@ void NameManager::sendAllNamesToServer (std::vector<uint32> const & servers) con
|
||||
stationIds.push_back(static_cast<int>(i->second.stationId));
|
||||
characterNames.push_back(i->second.characterName);
|
||||
characterFullNames.push_back(i->second.characterFullName);
|
||||
characterCreateTimes.push_back(static_cast<int64>(i->second.createTime));
|
||||
characterLastLoginTimes.push_back(static_cast<int64>(i->second.lastLoginTime));
|
||||
characterCreateTimes.push_back(static_cast<int>(i->second.createTime));
|
||||
characterLastLoginTimes.push_back(static_cast<int>(i->second.lastLoginTime));
|
||||
}
|
||||
|
||||
ServerMessageForwarding::begin(servers);
|
||||
|
||||
@@ -32,8 +32,8 @@ class NameManager
|
||||
|
||||
public:
|
||||
int getTotalPlayerCount () const;
|
||||
void addPlayer (const NetworkId &id, StationId stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers);
|
||||
void addPlayers (const std::vector<NetworkId> &ids, const std::vector<StationId> &stationIds, const std::vector<std::string> &names, const std::vector<std::string> &fullNames, const std::vector<int64> &createTimes, const std::vector<int64> &lastLoginTimes);
|
||||
void addPlayer (const NetworkId &id, uint32 stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers);
|
||||
void addPlayers (const std::vector<NetworkId> &ids, const std::vector<int> &stationIds, const std::vector<std::string> &names, const std::vector<std::string> &fullNames, const std::vector<int> &createTimes, const std::vector<int> &lastLoginTimes);
|
||||
void renamePlayer (const NetworkId &id, const Unicode::String &name, const Unicode::String &fullName);
|
||||
std::string debugGetNameList () const;
|
||||
bool isPlayer (NetworkId const & possiblePlayer) const;
|
||||
@@ -41,8 +41,8 @@ class NameManager
|
||||
uint32 getPlayerStationId (const NetworkId &id) const;
|
||||
const std::string & getPlayerName (const NetworkId &id) const;
|
||||
const std::string & getPlayerFullName (const NetworkId &id) const;
|
||||
int64 getPlayerCreateTime (const NetworkId &id) const;
|
||||
int64 getPlayerLastLoginTime (const NetworkId &id) const;
|
||||
int getPlayerCreateTime (const NetworkId &id) const;
|
||||
int getPlayerLastLoginTime (const NetworkId &id) const;
|
||||
void getPlayerWithLastLoginTimeAfter (time_t time, std::multimap<time_t, std::pair<std::pair<NetworkId, uint32>, std::string> > &result) const;
|
||||
void getPlayerWithLastLoginTimeBefore (time_t time, std::multimap<time_t, std::pair<std::pair<NetworkId, uint32>, std::string> > &result) const;
|
||||
void getPlayerWithLastLoginTimeBetween (time_t timeLowerRange, time_t timeUpperRange, std::multimap<time_t, std::pair<std::pair<NetworkId, uint32>, std::string> > &result) const;
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
// ======================================================================
|
||||
|
||||
CharacterNamesMessage::CharacterNamesMessage(const std::vector<NetworkId> &ids, const std::vector<StationId> &stationIds, const std::vector<std::string> &characterNames, const std::vector<std::string> &characterFullNames, const std::vector<int64> &createTimes, const std::vector<int64> &loginTimes) :
|
||||
CharacterNamesMessage::CharacterNamesMessage(const std::vector<NetworkId> &ids, const std::vector<int> &stationIds, const std::vector<std::string> &characterNames, const std::vector<std::string> &characterFullNames, const std::vector<int> &createTimes, const std::vector<int> &loginTimes) :
|
||||
GameNetworkMessage("CharacterNamesMessage"),
|
||||
m_ids(),
|
||||
m_stationIds(),
|
||||
|
||||
+7
-7
@@ -21,7 +21,7 @@
|
||||
class CharacterNamesMessage : public GameNetworkMessage
|
||||
{
|
||||
public:
|
||||
CharacterNamesMessage(const std::vector<NetworkId> &ids, const std::vector<StationId> &stationIds, const std::vector<std::string> &characterNames, const std::vector<std::string> &characterFullNames, const std::vector<int64> &createTimes, const std::vector<int64> &loginTimes);
|
||||
CharacterNamesMessage(const std::vector<NetworkId> &ids, const std::vector<int> &stationIds, const std::vector<std::string> &characterNames, const std::vector<std::string> &characterFullNames, const std::vector<int> &createTimes, const std::vector<int> &loginTimes);
|
||||
CharacterNamesMessage(Archive::ReadIterator & source);
|
||||
~CharacterNamesMessage();
|
||||
|
||||
@@ -29,16 +29,16 @@ class CharacterNamesMessage : public GameNetworkMessage
|
||||
const std::vector<int> &getStationIds() const;
|
||||
const std::vector<std::string> &getNames() const;
|
||||
const std::vector<std::string> &getFullNames() const;
|
||||
const std::vector<int64> &getCreateTimes() const;
|
||||
const std::vector<int64> &getLoginTimes() const;
|
||||
const std::vector<int> &getCreateTimes() const;
|
||||
const std::vector<int> &getLoginTimes() const;
|
||||
|
||||
private:
|
||||
Archive::AutoArray<NetworkId> m_ids;
|
||||
Archive::AutoArray<int> m_stationIds;
|
||||
Archive::AutoArray<std::string> m_names;
|
||||
Archive::AutoArray<std::string> m_fullNames;
|
||||
Archive::AutoArray<int64> m_createTimes;
|
||||
Archive::AutoArray<int64> m_loginTimes;
|
||||
Archive::AutoArray<int> m_createTimes;
|
||||
Archive::AutoArray<int> m_loginTimes;
|
||||
|
||||
private:
|
||||
//disabled functions:
|
||||
@@ -78,14 +78,14 @@ inline const std::vector<std::string> & CharacterNamesMessage::getFullNames() co
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline const std::vector<int64> & CharacterNamesMessage::getCreateTimes() const
|
||||
inline const std::vector<int> & CharacterNamesMessage::getCreateTimes() const
|
||||
{
|
||||
return m_createTimes.get();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline const std::vector<int64> & CharacterNamesMessage::getLoginTimes() const
|
||||
inline const std::vector<int> & CharacterNamesMessage::getLoginTimes() const
|
||||
{
|
||||
return m_loginTimes.get();
|
||||
}
|
||||
|
||||
+2
-21
@@ -72,26 +72,7 @@ std::unordered_map<int, std::string> webAPI::getStringMap(const std::string &slo
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::unordered_map<int64_t, std::string> webAPI::getStringMap64(const std::string &slot) {
|
||||
std::unordered_map<int64_t, std::string> ret = std::unordered_map<int64_t, std::string>();
|
||||
|
||||
if (!responseData.empty() && !slot.empty() && responseData.count(slot) && !responseData[slot].is_null()) {
|
||||
|
||||
nlohmann::json j = responseData[slot];
|
||||
|
||||
for (nlohmann::json::iterator it = j.begin(); it != j.end(); ++it) {
|
||||
std::string tmp(it.key());
|
||||
int64_t k = strtoll(tmp.c_str(), nullptr, 10);
|
||||
std::string val = it.value();
|
||||
|
||||
ret.insert({k, val});
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool webAPI::submit(const int32_t &reqType, const int32_t &getPost, const int32_t &respType) {
|
||||
bool webAPI::submit(const int &reqType, const int &getPost, const int &respType) {
|
||||
if (reqType == DTYPE::JSON) // json request
|
||||
{
|
||||
if (!requestData.empty()) {
|
||||
@@ -112,7 +93,7 @@ bool webAPI::submit(const int32_t &reqType, const int32_t &getPost, const int32_
|
||||
return false;
|
||||
}
|
||||
|
||||
bool webAPI::fetch(const int32_t &getPost, const int32_t &mimeType) // 0 for json 1 for string
|
||||
bool webAPI::fetch(const int &getPost, const int &mimeType) // 0 for json 1 for string
|
||||
{
|
||||
bool fetchStatus = false;
|
||||
|
||||
|
||||
Vendored
+2
-5
@@ -49,7 +49,7 @@ namespace StellaBellum {
|
||||
|
||||
// submits the request
|
||||
bool
|
||||
submit(const int32_t &reqType = DTYPE::JSON, const int32_t &getPost = HTTP::POST, const int32_t &respType = DTYPE::JSON);
|
||||
submit(const int &reqType = DTYPE::JSON, const int &getPost = HTTP::POST, const int &respType = DTYPE::JSON);
|
||||
|
||||
// set the endpoint after object creation...or change the target if needed
|
||||
bool setEndpoint(const std::string endpoint);
|
||||
@@ -66,9 +66,6 @@ namespace StellaBellum {
|
||||
// get a vector of strings from a given slot
|
||||
std::unordered_map<int, std::string> getStringMap(const std::string &slot);
|
||||
|
||||
// get a 64 bit keyed vector of strings from a given slot
|
||||
std::unordered_map<int64_t, std::string> getStringMap64(const std::string &slot);
|
||||
|
||||
// set json key and value for request
|
||||
template<typename T> bool addJsonData(const std::string &key, const T &value) {
|
||||
if (!key.empty() &&
|
||||
@@ -107,7 +104,7 @@ namespace StellaBellum {
|
||||
std::string uri;
|
||||
|
||||
// fetcher - returns raw response direct from remote
|
||||
bool fetch(const int32_t &getPost = HTTP::POST, const int32_t &mimeType = DTYPE::JSON);
|
||||
bool fetch(const int &getPost = HTTP::POST, const int &mimeType = DTYPE::JSON);
|
||||
|
||||
// cURL writeback callback
|
||||
static size_t writeCallback(void *contents, size_t size, size_t nmemb, void *userp);
|
||||
|
||||
Reference in New Issue
Block a user