MCPcopy Create free account
hub / github.com/chrxh/alien / getUserList

Method getUserList

source/Network/NetworkService.cpp:327–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327bool NetworkService::getUserList(std::vector<UserTO>& result, bool withRetry)
328{
329 log(Priority::Important, "network: get user list");
330
331 httplib::SSLClient client(_serverAddress);
332 configureClient(client);
333
334 try {
335 httplib::Params params;
336 auto postResult = executeRequest([&] { return client.Post("/alien-server/getuserlist.php", params); }, withRetry);
337
338 std::stringstream stream(postResult->body);
339 boost::property_tree::ptree tree;
340 boost::property_tree::read_json(stream, tree);
341 result.clear();
342 result = NetworkResourceParserService::get().decodeUserData(tree);
343 for (UserTO& userData : result) {
344 userData.timeSpent = userData.timeSpent * RefreshInterval / 60;
345 }
346 return true;
347 } catch (...) {
348 logNetworkError();
349 return false;
350 }
351}
352
353bool NetworkService::getEmojiTypeByResourceId(std::unordered_map<std::string, int>& result)
354{

Callers 1

processRequestMethod · 0.80

Calls 7

logFunction · 0.85
configureClientFunction · 0.85
executeRequestFunction · 0.85
logNetworkErrorFunction · 0.85
PostMethod · 0.80
decodeUserDataMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected