+ SV_SendClientDatagram (host_client);
+ }
+
+// clear muzzle flashes
+ SV_CleanupEnts();
+}
+
+void SV_StartDownload_f(void)
+{
+ if (host_client->download_file)
+ host_client->download_started = true;
+}
+
+void SV_Download_f(void)
+{
+ const char *whichpack, *whichpack2, *extension;
+
+ if (Cmd_Argc() != 2)
+ {
+ SV_ClientPrintf("usage: download <filename>\n");
+ return;
+ }
+
+ if (FS_CheckNastyPath(Cmd_Argv(1), false))
+ {
+ SV_ClientPrintf("Download rejected: nasty filename \"%s\"\n", Cmd_Argv(1));
+ return;
+ }
+
+ if (host_client->download_file)
+ {
+ // at this point we'll assume the previous download should be aborted
+ Con_DPrintf("Download of %s aborted by %s starting a new download\n", host_client->download_name, host_client->name);
+ Host_ClientCommands("\nstopdownload\n");
+
+ // close the file and reset variables
+ FS_Close(host_client->download_file);
+ host_client->download_file = NULL;
+ host_client->download_name[0] = 0;
+ host_client->download_expectedposition = 0;
+ host_client->download_started = false;
+ }
+
+ if (!sv_allowdownloads.integer)
+ {
+ SV_ClientPrintf("Downloads are disabled on this server\n");
+ Host_ClientCommands("\nstopdownload\n");
+ return;
+ }
+
+ strlcpy(host_client->download_name, Cmd_Argv(1), sizeof(host_client->download_name));
+
+ // host_client is asking to download a specified file
+ if (developer.integer >= 100)
+ Con_Printf("Download request for %s by %s\n", host_client->download_name, host_client->name);
+
+ if (!FS_FileExists(host_client->download_name))
+ {
+ SV_ClientPrintf("Download rejected: server does not have the file \"%s\"\nYou may need to separately download or purchase the data archives for this game/mod to get this file\n", host_client->download_name);
+ Host_ClientCommands("\nstopdownload\n");
+ return;
+ }
+
+ // check if the user is trying to download part of registered Quake(r)
+ whichpack = FS_WhichPack(host_client->download_name);
+ whichpack2 = FS_WhichPack("gfx/pop.lmp");
+ if ((whichpack && whichpack2 && !strcasecmp(whichpack, whichpack2)) || FS_IsRegisteredQuakePack(host_client->download_name))
+ {
+ SV_ClientPrintf("Download rejected: file \"%s\" is part of registered Quake(r)\nYou must purchase Quake(r) from id Software or a retailer to get this file\nPlease go to http://www.idsoftware.com/games/quake/quake/index.php?game_section=buy\n", host_client->download_name);
+ Host_ClientCommands("\nstopdownload\n");
+ return;
+ }
+
+ // check if the server has forbidden archive downloads entirely
+ if (!sv_allowdownloads_inarchive.integer)
+ {
+ whichpack = FS_WhichPack(host_client->download_name);
+ if (whichpack)