|
UFO: Alien Invasion
|
UFOAI web interface management. c(lient)game related stuff. More...
#include "web_cgame.h"#include "web_main.h"#include "../cl_shared.h"#include "../cgame/cl_game.h"#include "../ui/ui_main.h"#include "../../shared/parse.h"
Go to the source code of this file.
Macros | |
| #define | URL_SIZE 576 |
Functions | |
| static const char * | WEB_CGameGetURL (char *out, size_t outSize, const char *url, const char *cgameId, int category, const char *filename, int userId=-1) |
| Replaces placeholders in the urls with given values. | |
| bool | WEB_CGameUpload (const char *cgameId, int category, const char *filename) |
| Uploads a file to the server. | |
| bool | WEB_CGameDelete (const char *cgameId, int category, const char *filename) |
| Deletes a user owned file on the server. | |
| bool | WEB_CGameDownloadFromUser (const char *cgameId, int category, const char *filename, int userId) |
| Downloads a file from the server and store it in the user directory. | |
| static void | WEB_ListCGameFilesCallback (const char *responseBuf, void *userdata) |
| The http callback for the cgame list command. | |
| int | WEB_CGameListForUser (const char *cgameId, int category, int userId) |
| Shows the uploaded files for the particular cgame category and the given userid. | |
| static void | WEB_UploadCGame_f (void) |
| static void | WEB_DeleteCGame_f (void) |
| static void | WEB_DownloadCGame_f (void) |
| static void | WEB_ListCGame_f (void) |
| void | WEB_CGameCvars (void) |
| void | WEB_CGameCommands (void) |
Variables | |
| static cvar_t * | web_cgamedownloadurl |
| static cvar_t * | web_cgamedeleteurl |
| static cvar_t * | web_cgameuploadurl |
| static cvar_t * | web_cgamelisturl |
UFOAI web interface management. c(lient)game related stuff.
Definition in file web_cgame.cpp.
| #define URL_SIZE 576 |
Definition at line 37 of file web_cgame.cpp.
Referenced by WEB_CGameDelete(), WEB_CGameDownloadFromUser(), WEB_CGameGetURL(), WEB_CGameListForUser(), and WEB_CGameUpload().
Definition at line 411 of file web_cgame.cpp.
References Cmd_AddCommand(), WEB_DeleteCGame_f(), WEB_DownloadCGame_f(), WEB_ListCGame_f(), and WEB_UploadCGame_f().
Referenced by WEB_InitStartup().
Definition at line 403 of file web_cgame.cpp.
References Cvar_Get(), WEB_API_SERVER, web_cgamedeleteurl, web_cgamedownloadurl, web_cgamelisturl, and web_cgameuploadurl.
Referenced by WEB_InitStartup().
| bool WEB_CGameDelete | ( | const char * | cgameId, |
| int | category, | ||
| const char * | filename ) |
Deletes a user owned file on the server.
| [in] | cgameId | The cgame id that is used to get the file. |
| [in] | category | The category of the cgame. |
| [in] | filename | The filename to replace in the URL. |
true if the deletion of the file was successful, false otherwise. Definition at line 152 of file web_cgame.cpp.
References Com_Printf(), Com_SkipPath(), Com_StripExtension(), MAX_VAR, UI_ExecuteConfunc(), URL_SIZE, web_cgamedeleteurl, WEB_CGameGetURL(), WEB_CheckAuth(), WEB_GetURL(), and web_userid.
Referenced by GAME_WebDelete(), TEST_F(), and WEB_DeleteCGame_f().
| bool WEB_CGameDownloadFromUser | ( | const char * | cgameId, |
| int | category, | ||
| const char * | filename, | ||
| int | userId ) |
Downloads a file from the server and store it in the user directory.
| [in] | cgameId | The cgame id that is used to get the file. |
| [in] | category | The category of the cgame. |
| [in] | filename | The filename to replace in the URL. |
| [in] | userId | The user id to get the file for. If this is -1 (the default), the current authenticated user will be taken. |
true if the download of the file was successful, false otherwise. Definition at line 187 of file web_cgame.cpp.
References Com_Printf(), f, FILE_WRITE, FS_OpenFile(), GAME_GetRelativeSavePath(), HTTP_GetToFile(), MAX_OSPATH, Q_strcat(), URL_SIZE, web_cgamedownloadurl, and WEB_CGameGetURL().
Referenced by GAME_WebDownloadFromUser(), TEST_F(), and WEB_DownloadCGame_f().
|
static |
Replaces placeholders in the urls with given values.
| [out] | out | The final url |
| [in] | outSize | The size of the out buffer |
| [in] | url | The url with all the placeholders included |
| [in] | cgameId | The cgame id. Mandatory. May not be null. |
| [in] | category | The category of the cgame. If -1 then skip it. |
| [in] | filename | The filename to replace. If null, then skip it. |
| [in] | userId | The user id to replace. If -1 then skip it. |
buf pointer, or null in case of an error. Definition at line 50 of file web_cgame.cpp.
References Com_Printf(), Com_sprintf(), HTTP_Encode(), i, id, lengthof, MAX_VAR, Q_strncpyz(), Q_strreplace(), and URL_SIZE.
Referenced by WEB_CGameDelete(), WEB_CGameDownloadFromUser(), WEB_CGameListForUser(), and WEB_CGameUpload().
Shows the uploaded files for the particular cgame category and the given userid.
| [in] | cgameId | The cgame id that is used to get a filelist for. |
| [in] | category | The category of the cgame. |
| [in] | userId | The user id to get the file list for. If this is -1 (the default), the current authenticated user will be taken. |
-1 on error. Definition at line 310 of file web_cgame.cpp.
References Com_Printf(), count, UI_ExecuteConfunc(), URL_SIZE, WEB_CGameGetURL(), web_cgamelisturl, WEB_CheckAuth(), WEB_GetURL(), WEB_ListCGameFilesCallback(), and web_userid.
Referenced by GAME_WebListForUser(), TEST_F(), and WEB_ListCGame_f().
| bool WEB_CGameUpload | ( | const char * | cgameId, |
| int | category, | ||
| const char * | filename ) |
Uploads a file to the server.
| [in] | cgameId | The cgame id that is used to upload the file. |
| [in] | category | The category of the cgame. |
| [in] | filename | The filename part below the gamedir |
true if the upload of the file was successful, false otherwise. Definition at line 106 of file web_cgame.cpp.
References Com_Printf(), FS_FileExists(), FS_Gamedir(), Q_strnull(), UI_ExecuteConfunc(), URL_SIZE, va(), WEB_CGameGetURL(), web_cgameuploadurl, WEB_CheckAuth(), and WEB_PutFile().
Referenced by GAME_WebUpload(), TEST_F(), and WEB_UploadCGame_f().
Definition at line 352 of file web_cgame.cpp.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), GAME_GetCurrentName(), name, and WEB_CGameDelete().
Referenced by WEB_CGameCommands().
Definition at line 368 of file web_cgame.cpp.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), GAME_GetCurrentName(), name, and WEB_CGameDownloadFromUser().
Referenced by WEB_CGameCommands().
Definition at line 385 of file web_cgame.cpp.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), GAME_GetCurrentName(), name, and WEB_CGameListForUser().
Referenced by WEB_CGameCommands().
The http callback for the cgame list command.
| [in] | responseBuf | The cgame list in ufo script format |
| [in] | userdata | This can be used to return the amount of files that were listed |
Definition at line 218 of file web_cgame.cpp.
References Com_DPrintf(), Com_EParseValue(), Com_Parse(), Com_Printf(), Com_SkipPath(), Com_StripExtension(), count, DEBUG_CLIENT, level, MAX_OSPATH, MAX_VAR, MEMBER_SIZEOF, name, OBJZERO, value_t::ofs, Q_streq, value_t::size, value_t::string, value_t::type, UI_ExecuteConfunc(), V_INT, V_NULL, V_STRING, and web_userid.
Referenced by WEB_CGameListForUser().
Definition at line 334 of file web_cgame.cpp.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), GAME_GetCurrentName(), GAME_GetRelativeSavePath(), MAX_OSPATH, name, Q_strcat(), and WEB_CGameUpload().
Referenced by WEB_CGameCommands().
|
static |
Definition at line 33 of file web_cgame.cpp.
Referenced by WEB_CGameCvars(), and WEB_CGameDelete().
|
static |
Definition at line 32 of file web_cgame.cpp.
Referenced by WEB_CGameCvars(), and WEB_CGameDownloadFromUser().
|
static |
Definition at line 35 of file web_cgame.cpp.
Referenced by WEB_CGameCvars(), and WEB_CGameListForUser().
|
static |
Definition at line 34 of file web_cgame.cpp.
Referenced by WEB_CGameCvars(), and WEB_CGameUpload().