]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - libcurl.c
lhnet: Use the generic linked list
[xonotic/darkplaces.git] / libcurl.c
index 65a796986646806915c268308dbab43c4690fedc..c29a189426b3c3abef143d51e6ac619df817d8d1 100644 (file)
--- a/libcurl.c
+++ b/libcurl.c
@@ -7,14 +7,14 @@
 #include "jpeg.h"
 #include "image_png.h"
 
-static cvar_t cl_curl_maxdownloads = {CVAR_CLIENT | CVAR_SAVE, "cl_curl_maxdownloads","1", "maximum number of concurrent HTTP/FTP downloads"};
-static cvar_t cl_curl_maxspeed = {CVAR_CLIENT | CVAR_SAVE, "cl_curl_maxspeed","300", "maximum download speed (KiB/s)"};
-static cvar_t sv_curl_defaulturl = {CVAR_SERVER | CVAR_SAVE, "sv_curl_defaulturl","", "default autodownload source URL"};
-static cvar_t sv_curl_serverpackages = {CVAR_SERVER | CVAR_SAVE, "sv_curl_serverpackages","", "list of required files for the clients, separated by spaces"};
-static cvar_t sv_curl_maxspeed = {CVAR_SERVER | CVAR_SAVE, "sv_curl_maxspeed","0", "maximum download speed for clients downloading from sv_curl_defaulturl (KiB/s)"};
-static cvar_t cl_curl_enabled = {CVAR_CLIENT | CVAR_SAVE, "cl_curl_enabled","1", "whether client's download support is enabled"};
-static cvar_t cl_curl_useragent = {CVAR_CLIENT, "cl_curl_useragent","1", "send the User-Agent string (note: turning this off may break stuff)"};
-static cvar_t cl_curl_useragent_append = {CVAR_CLIENT, "cl_curl_useragent_append","", "a string to append to the User-Agent string (useful for name and version number of your mod)"};
+static cvar_t cl_curl_maxdownloads = {CF_CLIENT | CF_ARCHIVE, "cl_curl_maxdownloads","1", "maximum number of concurrent HTTP/FTP downloads"};
+static cvar_t cl_curl_maxspeed = {CF_CLIENT | CF_ARCHIVE, "cl_curl_maxspeed","300", "maximum download speed (KiB/s)"};
+static cvar_t sv_curl_defaulturl = {CF_SERVER | CF_ARCHIVE, "sv_curl_defaulturl","", "default autodownload source URL"};
+static cvar_t sv_curl_serverpackages = {CF_SERVER | CF_ARCHIVE, "sv_curl_serverpackages","", "list of required files for the clients, separated by spaces"};
+static cvar_t sv_curl_maxspeed = {CF_SERVER | CF_ARCHIVE, "sv_curl_maxspeed","0", "maximum download speed for clients downloading from sv_curl_defaulturl (KiB/s)"};
+static cvar_t cl_curl_enabled = {CF_CLIENT | CF_ARCHIVE, "cl_curl_enabled","1", "whether client's download support is enabled"};
+static cvar_t cl_curl_useragent = {CF_CLIENT, "cl_curl_useragent","1", "send the User-Agent string (note: turning this off may break stuff)"};
+static cvar_t cl_curl_useragent_append = {CF_CLIENT, "cl_curl_useragent_append","", "a string to append to the User-Agent string (useful for name and version number of your mod)"};
 
 /*
 =================================================================
@@ -331,16 +331,16 @@ static void Curl_CheckCommandWhenDone(void)
                if(numdownloads_fail == 0)
                {
                        Con_DPrintf("cURL downloads occurred, executing %s\n", command_when_done);
-                       Cbuf_AddText(&cmd_client, "\n");
-                       Cbuf_AddText(&cmd_client, command_when_done);
-                       Cbuf_AddText(&cmd_client, "\n");
+                       Cbuf_AddText(cmd_local, "\n");
+                       Cbuf_AddText(cmd_local, command_when_done);
+                       Cbuf_AddText(cmd_local, "\n");
                }
                else
                {
                        Con_DPrintf("cURL downloads FAILED, executing %s\n", command_when_error);
-                       Cbuf_AddText(&cmd_client, "\n");
-                       Cbuf_AddText(&cmd_client, command_when_error);
-                       Cbuf_AddText(&cmd_client, "\n");
+                       Cbuf_AddText(cmd_local, "\n");
+                       Cbuf_AddText(cmd_local, command_when_error);
+                       Cbuf_AddText(cmd_local, "\n");
                }
                Curl_Clear_forthismap();
        }
@@ -377,7 +377,7 @@ static qbool CURL_OpenLibrary (void)
                return true;
 
        // Load the DLL
-       return Sys_LoadLibrary (dllnames, &curl_dll, curlfuncs);
+       return Sys_LoadDependency (dllnames, &curl_dll, curlfuncs);
 }
 
 
@@ -390,7 +390,7 @@ Unload the cURL DLL
 */
 static void CURL_CloseLibrary (void)
 {
-       Sys_UnloadLibrary (&curl_dll);
+       Sys_FreeLibrary (&curl_dll);
 }
 
 
@@ -1119,13 +1119,13 @@ qbool Curl_Begin_ToMemory_POST(const char *URL, const char *extraheaders, double
 
 /*
 ====================
-Curl_Run
+Curl_Frame
 
 call this regularily as this will always download as much as possible without
 blocking.
 ====================
 */
-void Curl_Run(void)
+void Curl_Frame(void)
 {
        double maxspeed;
        downloadinfo *di;
@@ -1268,7 +1268,7 @@ void Curl_CancelAll(void)
 ====================
 Curl_Running
 
-returns true iff there is a download running.
+returns true if there is a download running.
 ====================
 */
 qbool Curl_Running(void)
@@ -1552,8 +1552,8 @@ void Curl_Init_Commands(void)
        Cvar_RegisterVariable (&sv_curl_maxspeed);
        Cvar_RegisterVariable (&cl_curl_useragent);
        Cvar_RegisterVariable (&cl_curl_useragent_append);
-       Cmd_AddCommand(CMD_CLIENT | CMD_CLIENT_FROM_SERVER, "curl", Curl_Curl_f, "download data from an URL and add to search path");
-       //Cmd_AddCommand(&cmd_client, "curlcat", Curl_CurlCat_f, "display data from an URL (debugging command)");
+       Cmd_AddCommand(CF_CLIENT | CF_CLIENT_FROM_SERVER, "curl", Curl_Curl_f, "download data from an URL and add to search path");
+       //Cmd_AddCommand(cmd_local, "curlcat", Curl_CurlCat_f, "display data from an URL (debugging command)");
 }
 
 /*