this should make things display properly again

This commit is contained in:
DarthArgus
2018-05-11 16:46:50 +00:00
parent 38bddb0d82
commit fd2775d9e8
3 changed files with 29 additions and 7 deletions

View File

@@ -161,7 +161,7 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
StationId user_id;
StationId parent_id;
std::unordered_map<int, std::string> childAccounts;
std::unordered_map<StationId, 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<int>("user_id"));
parent_id = static_cast<StationId>(api.getNullableValue<int>("parent_id"));
user_id = static_cast<StationId>(api.getNullableValue<StationId>("user_id"));
parent_id = static_cast<StationId>(api.getNullableValue<StationId>("parent_id"));
} else {
if (parentAccount.length() > MAX_ACCOUNT_NAME_LENGTH) {
parentAccount.resize(MAX_ACCOUNT_NAME_LENGTH);

View File

@@ -72,7 +72,26 @@ std::unordered_map<int, std::string> webAPI::getStringMap(const std::string &slo
return ret;
}
bool webAPI::submit(const int &reqType, const int &getPost, const int &respType) {
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) {
if (reqType == DTYPE::JSON) // json request
{
if (!requestData.empty()) {
@@ -93,7 +112,7 @@ bool webAPI::submit(const int &reqType, const int &getPost, const int &respType)
return false;
}
bool webAPI::fetch(const int &getPost, const int &mimeType) // 0 for json 1 for string
bool webAPI::fetch(const int32_t &getPost, const int32_t &mimeType) // 0 for json 1 for string
{
bool fetchStatus = false;

View File

@@ -49,7 +49,7 @@ namespace StellaBellum {
// submits the request
bool
submit(const int &reqType = DTYPE::JSON, const int &getPost = HTTP::POST, const int &respType = DTYPE::JSON);
submit(const int32_t &reqType = DTYPE::JSON, const int32_t &getPost = HTTP::POST, const int32_t &respType = DTYPE::JSON);
// set the endpoint after object creation...or change the target if needed
bool setEndpoint(const std::string endpoint);
@@ -66,6 +66,9 @@ 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() &&
@@ -104,7 +107,7 @@ namespace StellaBellum {
std::string uri;
// fetcher - returns raw response direct from remote
bool fetch(const int &getPost = HTTP::POST, const int &mimeType = DTYPE::JSON);
bool fetch(const int32_t &getPost = HTTP::POST, const int32_t &mimeType = DTYPE::JSON);
// cURL writeback callback
static size_t writeCallback(void *contents, size_t size, size_t nmemb, void *userp);