int DownloadRequest(void); /* ================ vmMain This is the only way control passes into the module. This must be the very first function compiled into the .q3vm file ================ */ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) { switch ( command ) { case GAME_INIT: G_InitGame( arg0, arg1, arg2 ); return 0; case GAME_SHUTDOWN: G_ShutdownGame( arg0 ); return 0; case GAME_CLIENT_CONNECT: return (int)ClientConnect( arg0, arg1, arg2 ); case GAME_CLIENT_THINK: ClientThink( arg0 ); return 0; case GAME_CLIENT_USERINFO_CHANGED: ClientUserinfoChanged( arg0 ); return 0; case GAME_CLIENT_DISCONNECT: ClientDisconnect( arg0 ); return 0; case GAME_CLIENT_BEGIN: ClientBegin( arg0, qtrue ); return 0; case GAME_CLIENT_COMMAND: ClientCommand( arg0 ); return 0; case GAME_RUN_FRAME: G_RunFrame( arg0 ); return 0; case GAME_CONSOLE_COMMAND: return ConsoleCommand(); case BOTAI_START_FRAME: return BotAIStartFrame( arg0 ); case GAME_ROFF_NOTETRACK_CALLBACK: G_ROFF_NotetrackCallback( &g_entities[arg0], (const char *)arg1 ); return 0; // JK2MF: receiving the JK2MF_DOWNLOAD_REQUEST event case JK2MF_DOWNLOAD_REQUEST: return DownloadRequest(); } return -1; } int DownloadRequest(void) { mfDownloadInfo downInf; trap_JK2MF_GetDownloadRequestInfo(&downInf); // Block a specific file programmatically if ( !Q_stricmp(downInf.fileName, "base/UltraSecretFile.pk3") ) { trap_SendServerCommand(-1, "print \"Someone requested base/UltraSecretFile.pk3^1! ^7NOPE^1!^7\n\""); // If this is a UDP request kick the client if ( downInf.clientNum != CLIENTNUM_UNKNOWN ) trap_DropClient(downInf.clientNum, "has been kicked from the server ( requested a secret file! )"); return DOWNLOAD_REJECT; } trap_SendServerCommand(-1, va("print \"%i^1.^7%i^1.^7%i^1.^7%i is requesting a download (via ^1%s^7) for the file ^1'%s^1'^7\n" "We are going to accept it.\n\"", downInf.IP[0], downInf.IP[1], downInf.IP[2], downInf.IP[3], ( downInf.protocol == REQUEST_UDP ) ? "UDP" : "HTTP", downInf.fileName)); return DOWNLOAD_PROCEED; }