248 writeChan (dbQueries serverInfo) $ CheckAccount clID (nick client) |
249 writeChan (dbQueries serverInfo) $ CheckAccount clID (nick client) |
249 return (clID, serverInfo, clients, rooms) |
250 return (clID, serverInfo, clients, rooms) |
250 where |
251 where |
251 client = clients ! clID |
252 client = clients ! clID |
252 |
253 |
|
254 |
253 processAction (clID, serverInfo, clients, rooms) (Dump) = do |
255 processAction (clID, serverInfo, clients, rooms) (Dump) = do |
254 writeChan (sendChan $ clients ! clID) ["DUMP", show serverInfo, showTree clients, showTree rooms] |
256 writeChan (sendChan $ clients ! clID) ["DUMP", show serverInfo, showTree clients, showTree rooms] |
255 return (clID, serverInfo, clients, rooms) |
257 return (clID, serverInfo, clients, rooms) |
256 |
258 |
|
259 |
257 processAction (clID, serverInfo, clients, rooms) (ProcessAccountInfo info) = do |
260 processAction (clID, serverInfo, clients, rooms) (ProcessAccountInfo info) = do |
258 case info of |
261 case info of |
259 HasAccount -> do |
262 HasAccount passwd -> do |
260 infoM "Clients" $ show clID ++ " has account" |
263 infoM "Clients" $ show clID ++ " has account" |
261 writeChan (sendChan $ clients ! clID) ["ASKPASSWORD"] |
264 writeChan (sendChan $ clients ! clID) ["ASKPASSWORD"] |
262 LogonPassed -> do |
265 return (clID, serverInfo, adjust (\cl -> cl{webPassword = passwd}) clID clients, rooms) |
263 infoM "Clients" $ show clID ++ " authenticated" |
|
264 Guest -> do |
266 Guest -> do |
265 infoM "Clients" $ show clID ++ " is guest" |
267 infoM "Clients" $ show clID ++ " is guest" |
266 return (clID, serverInfo, clients, rooms) |
268 processAction (clID, serverInfo, adjust (\cl -> cl{logonPassed = True}) clID clients, rooms) MoveToLobby |
|
269 |
|
270 |
|
271 processAction (clID, serverInfo, clients, rooms) (MoveToLobby) = do |
|
272 foldM processAction (clID, serverInfo, clients, rooms) $ |
|
273 (RoomAddThisClient 0) |
|
274 : answerLobbyNicks |
|
275 -- ++ (answerServerMessage client clients) |
|
276 where |
|
277 lobbyNicks = Prelude.filter (\n -> (not (Prelude.null n))) $ Prelude.map nick $ elems clients |
|
278 answerLobbyNicks = if not $ Prelude.null lobbyNicks then |
|
279 [AnswerThisClient (["LOBBY:JOINED"] ++ lobbyNicks)] |
|
280 else |
|
281 [] |
|
282 |
|
283 |