89 else |
89 else |
90 [ |
90 [ |
91 MoveToRoom jRI |
91 MoveToRoom jRI |
92 , AnswerClients [sendChan cl] $ "JOINED" : nicks |
92 , AnswerClients [sendChan cl] $ "JOINED" : nicks |
93 , AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl] |
93 , AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl] |
94 , AnswerClients [sendChan cl] $ ["WARNING", "Room admin is " `B.append` ownerNick] |
|
95 , AnswerClients [sendChan cl] $ ["CLIENT_FLAGS", "+h", ownerNick] |
94 , AnswerClients [sendChan cl] $ ["CLIENT_FLAGS", "+h", ownerNick] |
96 ] |
95 ] |
97 ++ map (readynessMessage cl) jRoomClients |
96 ++ (if clientProto cl < 38 then map (readynessMessage cl) jRoomClients else [sendStateFlags cl jRoomClients]) |
98 ++ answerFullConfig cl (mapParams jRoom) (params jRoom) |
97 ++ answerFullConfig cl (mapParams jRoom) (params jRoom) |
99 ++ answerTeams cl jRoom |
98 ++ answerTeams cl jRoom |
100 ++ watchRound cl jRoom |
99 ++ watchRound cl jRoom |
101 |
100 |
102 where |
101 where |
103 readynessMessage cl c = AnswerClients [sendChan cl] $ |
102 readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c] |
104 if clientProto cl < 38 then |
103 sendStateFlags cl clients = AnswerClients [sendChan cl] . concat . intersperse [""] . filter (not . null) . concat $ |
105 [if isReady c then "READY" else "NOT_READY", nick c] |
104 [f "+r" ready, f "-r" unready, f "+g" ingame, f "-g" inroomlobby] |
106 else |
105 where |
107 ["CLIENT_FLAGS", if isReady c then "+r" else "-r", nick c] |
106 (ready, unready) = partition isReady clients |
|
107 (ingame, inroomlobby) = partition isInGame clients |
|
108 f fl lst = ["CLIENT_FLAGS" : fl : map nick lst | not $ null lst] |
108 |
109 |
109 toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs |
110 toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs |
110 |
111 |
111 answerFullConfig cl mpr pr |
112 answerFullConfig cl mpr pr |
112 | clientProto cl < 38 = map (toAnswer cl) $ |
113 | clientProto cl < 38 = map (toAnswer cl) $ |