# HG changeset patch # User unc0rr # Date 1225475639 0 # Node ID 8505cbfd9a2189303031969723921d827e3a0f54 # Parent 78167b9ddae027263a8882a2c7f3d1ba754f6081 Show clients list in server message diff -r 78167b9ddae0 -r 8505cbfd9a21 netserver/HWProto.hs --- a/netserver/HWProto.hs Fri Oct 31 17:48:17 2008 +0000 +++ b/netserver/HWProto.hs Fri Oct 31 17:53:59 2008 +0000 @@ -12,9 +12,13 @@ where hhsInfo = concatMap (\(HedgehogInfo name hat) -> [name, hat]) $ hedgehogs team -answerServerMessage = [(clientOnly, "SERVER_MESSAGE" : [body])] +answerServerMessage clients = [(clientOnly, "SERVER_MESSAGE" : [mainbody ++ clientsIn])] where - body = serverMessage globalOptions ++ if isDedicated globalOptions then "
Dedicated server
" else "Private server
" + mainbody = serverMessage globalOptions ++ if isDedicated globalOptions then "Dedicated server
" else "Private server
" + clientsIn = "" ++ (show $ length nicks) ++ " clients in: " ++ clientslist ++ "
" + clientslist = if not $ null nicks then foldr1 (\a b -> a ++ ", " ++ b) nicks else "" + nicks = filter (not . null) $ map nick clients + answerBadCmd = [(clientOnly, ["ERROR", "Bad command, state or incorrect parameter"])] answerNotMaster = [(clientOnly, ["ERROR", "You cannot configure room parameters"])] answerBadParam = [(clientOnly, ["ERROR", "Bad parameter"])] @@ -112,8 +116,8 @@ -- 'noRoom' clients state command handlers handleCmd_noRoom :: CmdHandler -handleCmd_noRoom client _ rooms ["LIST"] = - (noChangeClients, noChangeRooms, answerServerMessage ++ (answerRoomsList $ concatMap roomInfo $ sameProtoRooms)) +handleCmd_noRoom client clients rooms ["LIST"] = + (noChangeClients, noChangeRooms, answerServerMessage clients ++ (answerRoomsList $ concatMap roomInfo $ sameProtoRooms)) where roomInfo room = [ name room,