gameServer/HandlerUtils.hs
changeset 4932 f11d80bac7ed
parent 4614 26661bf28dd5
child 4975 31da8979e5b1
equal deleted inserted replaced
4931:da43c36a6e92 4932:f11d80bac7ed
    47     return $ map (sendChan . client rnc) (roomClients rnc ri)
    47     return $ map (sendChan . client rnc) (roomClients rnc ri)
    48 
    48 
    49 thisClientChans :: Reader (ClientIndex, IRnC) [ClientChan]
    49 thisClientChans :: Reader (ClientIndex, IRnC) [ClientChan]
    50 thisClientChans = do
    50 thisClientChans = do
    51     (ci, rnc) <- ask
    51     (ci, rnc) <- ask
    52     return $ [sendChan (rnc `client` ci)]
    52     return [sendChan (rnc `client` ci)]
    53 
    53 
    54 answerClient :: [B.ByteString] -> Reader (ClientIndex, IRnC) [Action]
    54 answerClient :: [B.ByteString] -> Reader (ClientIndex, IRnC) [Action]
    55 answerClient msg = thisClientChans >>= return . (: []) . flip AnswerClients msg
    55 answerClient msg = liftM ((: []) . flip AnswerClients msg) thisClientChans
    56 
    56 
    57 allRoomInfos :: Reader (a, IRnC) [RoomInfo]
    57 allRoomInfos :: Reader (a, IRnC) [RoomInfo]
    58 allRoomInfos = liftM ((\irnc -> map (room irnc) $ allRooms irnc) . snd) ask
    58 allRoomInfos = liftM ((\irnc -> map (room irnc) $ allRooms irnc) . snd) ask
    59 
    59 
    60 clientByNick :: B.ByteString -> Reader (ClientIndex, IRnC) (Maybe ClientIndex)
    60 clientByNick :: B.ByteString -> Reader (ClientIndex, IRnC) (Maybe ClientIndex)