netserver/HWProto.hs
changeset 1452 8505cbfd9a21
parent 1442 ef9785d0b392
child 1461 87e5a6c3882c
--- 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 "<p align=center>Dedicated server</p>" else "<p align=center>Private server</p>"
+		mainbody = serverMessage globalOptions ++ if isDedicated globalOptions then "<p align=center>Dedicated server</p>" else "<p align=center>Private server</p>"
+		clientsIn = "<p align=left>" ++ (show $ length nicks) ++ " clients in: " ++ clientslist ++ "</p>"
+		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,