================ SVC_Status Responds with all the info that qplug or qspy can see about the server and all connected players. Used for getting detailed information after the simple info query. ================ */
| 174 | ================ |
| 175 | */ |
| 176 | void SVC_Status( netadr_t from ) { |
| 177 | char player[1024]; |
| 178 | char status[MAX_MSGLEN]; |
| 179 | int i; |
| 180 | client_t *cl; |
| 181 | int statusLength; |
| 182 | int playerLength; |
| 183 | int score; |
| 184 | char infostring[MAX_INFO_STRING]; |
| 185 | |
| 186 | strcpy( infostring, Cvar_InfoString( CVAR_SERVERINFO ) ); |
| 187 | |
| 188 | // echo back the parameter to status. so servers can use it as a challenge |
| 189 | // to prevent timed spoofed reply packets that add ghost servers |
| 190 | Info_SetValueForKey( infostring, "challenge", Cmd_Argv(1) ); |
| 191 | |
| 192 | status[0] = 0; |
| 193 | statusLength = 0; |
| 194 | |
| 195 | for (i=0 ; i < 1 ; i++) { |
| 196 | cl = &svs.clients[i]; |
| 197 | if ( cl->state >= CS_CONNECTED ) { |
| 198 | if ( cl->gentity && cl->gentity->client ) { |
| 199 | score = cl->gentity->client->persistant[PERS_SCORE]; |
| 200 | } else { |
| 201 | score = 0; |
| 202 | } |
| 203 | Com_sprintf( player, sizeof( player ), "%i %i \"%s\"\n", score, cl->name ); |
| 204 | playerLength = strlen(player); |
| 205 | if (statusLength + playerLength >= (int)sizeof(status) ) { |
| 206 | break; // can't hold any more |
| 207 | } |
| 208 | strcpy (status + statusLength, player); |
| 209 | statusLength += playerLength; |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | NET_OutOfBandPrint( NS_SERVER, from, "statusResponse\n%s\n%s", infostring, status ); |
| 214 | } |
| 215 | |
| 216 | /* |
| 217 | ================ |
no test coverage detected