| 2030 | //----------------------------------------------------------------------------- |
| 2031 | |
| 2032 | static void handleGameInfoResponse( const NetAddress* address, BitStream* stream, U32 /*key*/, U8 /*flags*/ ) |
| 2033 | { |
| 2034 | if ( !gQueryList.size() ) |
| 2035 | return; |
| 2036 | |
| 2037 | S32 index = findPingEntry( gQueryList, address ); |
| 2038 | if ( index == -1 ) |
| 2039 | return; |
| 2040 | |
| 2041 | // Remove the server from the query list since it has been so kind as to respond: |
| 2042 | gQueryList.erase( index ); |
| 2043 | updateQueryProgress(); |
| 2044 | ServerInfo *si = findServerInfo( address ); |
| 2045 | if ( !si ) |
| 2046 | return; |
| 2047 | |
| 2048 | bool isUpdate = si->isUpdating(); |
| 2049 | bool applyFilter = !isUpdate && ( sActiveFilter.type == ServerFilter::Normal ); |
| 2050 | char addrString[256]; |
| 2051 | Net::addressToString( address, addrString ); |
| 2052 | |
| 2053 | // Get the rules set: |
| 2054 | char stringBuf[2048]; // Who knows how big this should be? |
| 2055 | stream->readString( stringBuf ); |
| 2056 | if ( !si->gameType || dStricmp( si->gameType, stringBuf ) != 0 ) |
| 2057 | { |
| 2058 | si->gameType = (char*) dRealloc( (void*) si->gameType, dStrlen( stringBuf ) + 1 ); |
| 2059 | dStrcpy( si->gameType, stringBuf ); |
| 2060 | |
| 2061 | // Test against the active filter: |
| 2062 | if ( applyFilter && dStricmp( sActiveFilter.gameType, "any" ) != 0 |
| 2063 | && dStricmp( si->gameType, sActiveFilter.gameType ) != 0 ) |
| 2064 | { |
| 2065 | Con::printf( "Server %s filtered out by rules set. (%s:%s)", addrString, sActiveFilter.gameType, si->gameType ); |
| 2066 | removeServerInfo( address ); |
| 2067 | return; |
| 2068 | } |
| 2069 | } |
| 2070 | |
| 2071 | // Get the mission type: |
| 2072 | stream->readString( stringBuf ); |
| 2073 | if ( !si->missionType || dStrcmp( si->missionType, stringBuf ) != 0 ) |
| 2074 | { |
| 2075 | si->missionType = (char*) dRealloc( (void*) si->missionType, dStrlen( stringBuf ) + 1 ); |
| 2076 | dStrcpy( si->missionType, stringBuf ); |
| 2077 | |
| 2078 | // Test against the active filter: |
| 2079 | if ( applyFilter && dStricmp( sActiveFilter.missionType, "any" ) != 0 |
| 2080 | && dStricmp( si->missionType, sActiveFilter.missionType ) != 0 ) |
| 2081 | { |
| 2082 | Con::printf( "Server %s filtered out by mission type. (%s:%s)", addrString, sActiveFilter.missionType, si->missionType ); |
| 2083 | removeServerInfo( address ); |
| 2084 | return; |
| 2085 | } |
| 2086 | } |
| 2087 | |
| 2088 | // Get the mission name: |
| 2089 | stream->readString( stringBuf ); |
no test coverage detected