All pastes #274865 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-12-11 00:47 UTC
rendered paste body
Index: metaserver.pl.in
===================================================================
--- metaserver.pl.in    (revision 5050)
+++ metaserver.pl.in    (working copy)
@@ -7,6 +7,11 @@
 use Socket;
 use English;

+# this is a list of known versions of the crossfire server, which clients
+# may choose to filter on, anything not listed here is unknown, and clients
+# can't tell if the server will play nice or not.
+@known_versions=("1.5.0", "1.6.0", "1.7.0", "1.8.0", "1.9.0", "1.9.1");
+
 # We periodically generate a nice HTML file that people can't put their
 # web browser at.  This is the location of that file.
 $HTML_FILE="/var/apache/htdocs/metaserver.html";
@@ -83,6 +88,13 @@
            ($port, $ip) = sockaddr_in($ipaddr);
            $host = inet_ntoa $ip;
            ($name, $rest) = split /\|/, $data;
+           # check that the version is one we recognise
+           foreach $version(@known_versions) {
+             $matches+=!strcomp($rest[2], $version);
+           }
+           if ($matches==0) {
+             $rest[2] = "Unknown";
+            }
            if ($name ne "put.your.hostname.here") {
                $data{$host} = "$host|$cur_time|$data";
                $stats_updatehits++;