netserver/HWProto.hs
changeset 1493 1e422bc5d863
parent 1492 2da1fe033f23
child 1512 43742041c211
equal deleted inserted replaced
1492:2da1fe033f23 1493:1e422bc5d863
    70 		toAnswer team =
    70 		toAnswer team =
    71 			(answerClientOnly $ teamToNet team) ++
    71 			(answerClientOnly $ teamToNet team) ++
    72 			(answerClientOnly ["TEAM_COLOR", teamname team, teamcolor team]) ++
    72 			(answerClientOnly ["TEAM_COLOR", teamname team, teamcolor team]) ++
    73 			(answerClientOnly ["HH_NUM", teamname team, show $ hhnum team])
    73 			(answerClientOnly ["HH_NUM", teamname team, show $ hhnum team])
    74 
    74 
    75 answerServerMessage clients = [\serverInfo -> (clientOnly, "SERVER_MESSAGE" : [(mainbody serverInfo) ++ clientsIn])]
    75 answerServerMessage clients = [\serverInfo -> (clientOnly, "SERVER_MESSAGE" :
       
    76 		[(mainbody serverInfo) ++ clientsIn ++ (lastHour serverInfo)])]
    76 	where
    77 	where
    77 		mainbody serverInfo = serverMessage serverInfo ++
    78 		mainbody serverInfo = serverMessage serverInfo ++
    78 			if isDedicated serverInfo then
    79 			if isDedicated serverInfo then
    79 				"<p align=center>Dedicated server</p>"
    80 				"<p align=center>Dedicated server</p>"
    80 				else
    81 				else
    81 				"<p align=center>Private server</p>"
    82 				"<p align=center>Private server</p>"
    82 		
    83 		
    83 		clientsIn = "<p align=left>" ++ (show $ length nicks) ++ " clients in: " ++ clientslist ++ "</p>"
    84 		clientsIn = "<p align=left>" ++ (show $ length nicks) ++ " clients in: " ++ clientslist ++ "</p>"
    84 		clientslist = if not $ null nicks then foldr1 (\a b -> a  ++ ", " ++ b) nicks else ""
    85 		clientslist = if not $ null nicks then foldr1 (\a b -> a  ++ ", " ++ b) nicks else ""
       
    86 		lastHour serverInfo =
       
    87 			if isDedicated serverInfo then
       
    88 				"<p align=left>" ++ (show $ length $ lastHourUsers serverInfo) ++ " user logins in last hour</p>"
       
    89 				else
       
    90 				""
    85 		nicks = filter (not . null) $ map nick clients
    91 		nicks = filter (not . null) $ map nick clients
    86 
    92 
    87 answerPing = makeAnswer allClients ["PING"]
    93 answerPing = makeAnswer allClients ["PING"]
    88 
    94 
    89 
    95