diff -r 659e043da6da -r fbc6e7602e05 gameServer/Actions.hs --- a/gameServer/Actions.hs Sat Jan 19 00:55:51 2013 +0400 +++ b/gameServer/Actions.hs Sat Jan 19 21:51:41 2013 +0400 @@ -1,9 +1,10 @@ -{-# LANGUAGE CPP, OverloadedStrings #-} +{-# LANGUAGE CPP, OverloadedStrings, ScopedTypeVariables #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Actions where import Control.Concurrent import qualified Data.Set as Set +import qualified Data.Map as Map import qualified Data.List as L import qualified Control.Exception as Exception import System.Log.Logger @@ -75,6 +76,7 @@ | AddIP2Bans B.ByteString B.ByteString UTCTime | CheckBanned Bool | SaveReplay + | Stats type CmdHandler = [B.ByteString] -> Reader (ClientIndex, IRnC) [Action] @@ -640,6 +642,15 @@ return () processAction $ ModifyServerInfo (\s -> s{shutdownPending = True}) +processAction Stats = do + cls <- allClientsS + let stats = versions cls + processAction $ Warning stats + where + versions = B.concat . ((:) "") . (flip (++) ["
"]) + . concatMap (\(p, n :: Int) -> ["", protoNumber2ver p, "", showB n, ""]) + . Map.toList . Map.fromListWith (+) . map (\c -> (clientProto c, 1)) + #if defined(OFFICIAL_SERVER) processAction SaveReplay = do ri <- clientRoomA