return password_json;
}
-static void DownloadServerScoreToCacheExt(struct HttpRequest *request,
- struct HttpResponse *response,
- int level_nr,
- char *score_cache_filename)
+static void ApiGetScoreExt(struct HttpRequest *request,
+ struct HttpResponse *response,
+ int level_nr,
+ char *score_cache_filename)
{
request->hostname = setup.api_server_hostname;
request->port = API_SERVER_PORT;
server_scores.updated = TRUE;
}
-static void DownloadServerScoreToCache(int level_nr, char *score_cache_filename)
+static void ApiGetScore(int level_nr, char *score_cache_filename)
{
struct HttpRequest *request = checked_calloc(sizeof(struct HttpRequest));
struct HttpResponse *response = checked_calloc(sizeof(struct HttpResponse));
- DownloadServerScoreToCacheExt(request, response,
- level_nr, score_cache_filename);
+ ApiGetScoreExt(request, response,
+ level_nr, score_cache_filename);
checked_free(request);
checked_free(response);
}
-struct DownloadServerScoreToCacheThreadData
+struct ApiGetScoreThreadData
{
int level_nr;
char *score_cache_filename;
};
-static int DownloadServerScoreToCacheThread(void *data_raw)
+static int ApiGetScoreThread(void *data_raw)
{
- struct DownloadServerScoreToCacheThreadData *data = data_raw;
+ struct ApiGetScoreThreadData *data = data_raw;
- DownloadServerScoreToCache(data->level_nr,
- data->score_cache_filename);
+ ApiGetScore(data->level_nr,
+ data->score_cache_filename);
checked_free(data->score_cache_filename);
checked_free(data);
return 0;
}
-static void DownloadServerScoreToCacheAsThread(int nr)
+static void ApiGetScoreAsThread(int nr)
{
- struct DownloadServerScoreToCacheThreadData *data =
- checked_malloc(sizeof(struct DownloadServerScoreToCacheThreadData));
+ struct ApiGetScoreThreadData *data =
+ checked_malloc(sizeof(struct ApiGetScoreThreadData));
char *score_cache_filename = getScoreCacheFilename(nr);
data->level_nr = nr;
data->score_cache_filename = getStringCopy(score_cache_filename);
- ExecuteAsThread(DownloadServerScoreToCacheThread,
- "DownloadServerScoreToCache", data,
+ ExecuteAsThread(ApiGetScoreThread,
+ "ApiGetScore", data,
"download scores from server");
}
{
// 2nd step: download server scores from score server to cache file
// (as thread, as it might time out if the server is not reachable)
- DownloadServerScoreToCacheAsThread(nr);
+ ApiGetScoreAsThread(nr);
}
}
return buffer_encoded;
}
-static void UploadScoreToServerExt(struct HttpRequest *request,
- struct HttpResponse *response,
- int level_nr,
- char *score_tape_filename,
- struct ScoreEntry *score_entry)
+static void ApiAddScoreExt(struct HttpRequest *request,
+ struct HttpResponse *response,
+ int level_nr,
+ char *score_tape_filename,
+ struct ScoreEntry *score_entry)
{
request->hostname = setup.api_server_hostname;
request->port = API_SERVER_PORT;
server_scores.uploaded = TRUE;
}
-static void UploadScoreToServer(int level_nr, char *score_tape_filename,
- struct ScoreEntry *score_entry)
+static void ApiAddScore(int level_nr, char *score_tape_filename,
+ struct ScoreEntry *score_entry)
{
struct HttpRequest *request = checked_calloc(sizeof(struct HttpRequest));
struct HttpResponse *response = checked_calloc(sizeof(struct HttpResponse));
- UploadScoreToServerExt(request, response,
- level_nr, score_tape_filename, score_entry);
+ ApiAddScoreExt(request, response,
+ level_nr, score_tape_filename, score_entry);
checked_free(request);
checked_free(response);
}
-struct UploadScoreToServerThreadData
+struct ApiAddScoreThreadData
{
int level_nr;
char *score_tape_filename;
struct ScoreEntry score_entry;
};
-static int UploadScoreToServerThread(void *data_raw)
+static int ApiAddScoreThread(void *data_raw)
{
- struct UploadScoreToServerThreadData *data = data_raw;
+ struct ApiAddScoreThreadData *data = data_raw;
- UploadScoreToServer(data->level_nr,
- data->score_tape_filename,
- &data->score_entry);
+ ApiAddScore(data->level_nr,
+ data->score_tape_filename,
+ &data->score_entry);
checked_free(data->score_tape_filename);
checked_free(data);
return 0;
}
-static void UploadScoreToServerAsThread(int nr, char *score_tape_filename)
+static void ApiAddScoreAsThread(int nr, char *score_tape_filename)
{
- struct UploadScoreToServerThreadData *data =
- checked_malloc(sizeof(struct UploadScoreToServerThreadData));
+ struct ApiAddScoreThreadData *data =
+ checked_malloc(sizeof(struct ApiAddScoreThreadData));
struct ScoreEntry *score_entry = &scores.entry[scores.last_added];
if (score_tape_filename == NULL)
data->score_entry = *score_entry;
data->score_tape_filename = getStringCopy(score_tape_filename);
- ExecuteAsThread(UploadScoreToServerThread,
- "UploadScoreToServer", data,
+ ExecuteAsThread(ApiAddScoreThread,
+ "ApiAddScore", data,
"upload score to server");
}
if (!runtime.use_api_server)
return;
- UploadScoreToServerAsThread(nr, NULL);
+ ApiAddScoreAsThread(nr, NULL);
}
void SaveServerScoreFromFile(int nr, char *score_tape_filename)
if (!runtime.use_api_server)
return;
- UploadScoreToServerAsThread(nr, score_tape_filename);
+ ApiAddScoreAsThread(nr, score_tape_filename);
}
void LoadLocalAndServerScore(int nr, boolean download_score)
// change name functions
// ============================================================================
-static void RenamePlayerOnServerExt(struct HttpRequest *request,
- struct HttpResponse *response,
- char *player_name_raw,
- char *player_uuid_raw)
+static void ApiRenamePlayerExt(struct HttpRequest *request,
+ struct HttpResponse *response,
+ char *player_name_raw,
+ char *player_uuid_raw)
{
request->hostname = setup.api_server_hostname;
request->port = API_SERVER_PORT;
}
}
-static void RenamePlayerOnServer(char *player_name, char *player_uuid)
+static void ApiRenamePlayer(char *player_name, char *player_uuid)
{
struct HttpRequest *request = checked_calloc(sizeof(struct HttpRequest));
struct HttpResponse *response = checked_calloc(sizeof(struct HttpResponse));
- RenamePlayerOnServerExt(request, response, player_name, player_uuid);
+ ApiRenamePlayerExt(request, response, player_name, player_uuid);
checked_free(request);
checked_free(response);
}
-struct RenamePlayerOnServerThreadData
+struct ApiRenamePlayerThreadData
{
char *player_name;
char *player_uuid;
};
-static int RenamePlayerOnServerThread(void *data_raw)
+static int ApiRenamePlayerThread(void *data_raw)
{
- struct RenamePlayerOnServerThreadData *data = data_raw;
+ struct ApiRenamePlayerThreadData *data = data_raw;
- RenamePlayerOnServer(data->player_name, data->player_uuid);
+ ApiRenamePlayer(data->player_name, data->player_uuid);
checked_free(data->player_name);
checked_free(data->player_uuid);
return 0;
}
-static void RenamePlayerOnServerAsThread(void)
+static void ApiRenamePlayerAsThread(void)
{
- struct RenamePlayerOnServerThreadData *data =
- checked_malloc(sizeof(struct RenamePlayerOnServerThreadData));
+ struct ApiRenamePlayerThreadData *data =
+ checked_malloc(sizeof(struct ApiRenamePlayerThreadData));
data->player_name = getStringCopy(setup.player_name);
data->player_uuid = getStringCopy(setup.player_uuid);
- ExecuteAsThread(RenamePlayerOnServerThread,
- "RenamePlayerOnServer", data,
+ ExecuteAsThread(ApiRenamePlayerThread,
+ "ApiRenamePlayer", data,
"rename player on server");
}
SaveSetup();
// change name of edited user on score server
- RenamePlayerOnServerAsThread();
+ ApiRenamePlayerAsThread();
if (game_status == GAME_MODE_PSEUDO_TYPENAMES || reset_setup)
{