/* ============ ClientAdminChallenge ============ */ void ClientAdminChallenge( int clientNum ) { gclient_t *client = level.clients + clientNum; g_admin_admin_t *admin = client->pers.admin; if ( !client->pers.pubkey_authenticated && admin && admin->pubkey[ 0 ] && ( level.time - client->pers.pubkey_challengedAt ) >= 6000 ) { trap_SendServerCommand( clientNum, va( "pubkey_decrypt %s", admin->msg2 ) ); client->pers.pubkey_challengedAt = level.time ^ ( 5 * clientNum ); // a small amount of jitter // copy the decrypted message because generating a new message will overwrite it G_admin_writeconfig(); } }
/* =========== ClientBegin Called when a client has finished connecting, and is ready to be placed into the level. This will happen on every level load and level restart, but doesn't happen on respawns. ============ */ void ClientBegin( int clientNum ) { gentity_t *ent; gclient_t *client; int flags; g_admin_admin_t *admin; char startMsg[ MAX_STRING_CHARS ]; ent = g_entities + clientNum; client = level.clients + clientNum; admin = client->pers.admin; // ignore if client already entered the game if ( client->pers.connected != CON_CONNECTING ) { return; } if ( ent->r.linked ) { trap_UnlinkEntity( ent ); } G_InitGentity( ent ); ent->touch = 0; ent->pain = 0; ent->client = client; client->pers.connected = CON_CONNECTED; client->pers.enterTime = level.time; if ( !client->pers.pubkey_authenticated && admin && admin->pubkey[ 0 ] ) { trap_SendServerCommand( ent - g_entities, va( "pubkey_decrypt %s", admin->msg2 ) ); // copy the decrypted message because generating a new message will overwrite it G_admin_writeconfig(); } // save eflags around this, because changing teams will // cause this to happen with a valid entity, and we // want to make sure the teleport bit is set right // so the viewpoint doesn't interpolate through the // world to the new position flags = client->ps.eFlags; memset( &client->ps, 0, sizeof( client->ps ) ); memset( &client->pmext, 0, sizeof( client->pmext ) ); client->ps.eFlags = flags; // locate ent at a spawn point ClientSpawn( ent, NULL, NULL, NULL ); trap_SendServerCommand( -1, va( "print_tr %s %s", QQ( N_("$1$^7 entered the game\n") ), Quote( client->pers.netname ) ) ); trap_Cvar_VariableStringBuffer( "g_mapStartupMessage", startMsg, sizeof( startMsg ) ); if ( *startMsg ) { trap_SendServerCommand( ent - g_entities, va( "cpd %d %s", g_mapStartupMessageDelay.integer, Quote( startMsg ) ) ); } G_namelog_restore( client ); G_LogPrintf( "ClientBegin: %i\n", clientNum ); // count current clients and rank for scoreboard CalculateRanks(); // send the client a list of commands that can be used if ( !client->pers.admin ) { G_ListCommands( ent ); } }