# HG changeset patch # User unc0rr # Date 1301329861 -14400 # Node ID 7d0f6e5b1c1ce9571081444159649e02be0f465f # Parent 68a5415ca8ea19fa911b6c5a24f65d4bc7157850 Hide last two octets of IP address from usual users diff -r 68a5415ca8ea -r 7d0f6e5b1c1c gameServer/HWProtoCore.hs --- a/gameServer/HWProtoCore.hs Mon Mar 28 20:30:15 2011 +0400 +++ b/gameServer/HWProtoCore.hs Mon Mar 28 20:31:01 2011 +0400 @@ -43,6 +43,7 @@ handleCmd_loggedin ["INFO", asknick] = do (_, rnc) <- ask maybeClientId <- clientByNick asknick + isAdminAsking <- liftM isAdministrator thisClient let noSuchClient = isNothing maybeClientId let clientId = fromJust maybeClientId let cl = rnc `client` fromJust maybeClientId @@ -55,13 +56,14 @@ if teamsInGame cl > 0 then "(playing)" else "(spectating)" else "" + let hostStr = if isAdminAsking then host cl else cutHost $ host cl if noSuchClient then return [] else answerClient [ "INFO", nick cl, - B.concat ["[", host cl, "]"], + B.concat ["[", hostStr, "]"], protoNumber2ver $ clientProto cl, B.concat ["[", roomInfo, "]", roomStatus] ] diff -r 68a5415ca8ea -r 7d0f6e5b1c1c gameServer/Utils.hs --- a/gameServer/Utils.hs Mon Mar 28 20:30:15 2011 +0400 +++ b/gameServer/Utils.hs Mon Mar 28 20:31:01 2011 +0400 @@ -124,3 +124,6 @@ case B.readInt str of Just (i, t) | B.null t -> fromIntegral i _ -> 0 + +cutHost :: B.ByteString -> B.ByteString +cutHost = B.intercalate "." . flip (++) ["*","*"] . List.take 2 . B.split '.'