netserver/Miscutils.hs
changeset 902 3cc10f0aae37
parent 901 2f5ce9a584f9
child 1082 596b1dcdc1df
equal deleted inserted replaced
901:2f5ce9a584f9 902:3cc10f0aae37
    27 	}
    27 	}
    28 
    28 
    29 clientByHandle :: Handle -> [ClientInfo] -> ClientInfo
    29 clientByHandle :: Handle -> [ClientInfo] -> ClientInfo
    30 clientByHandle clhandle clients = fromJust $ find (\ci -> handle ci == clhandle) clients
    30 clientByHandle clhandle clients = fromJust $ find (\ci -> handle ci == clhandle) clients
    31 
    31 
       
    32 roomByName :: String -> [RoomInfo] -> RoomInfo
       
    33 roomByName roomName rooms = fromJust $ find (\room -> roomName == name room) rooms
       
    34 
    32 fromRoomHandles :: String -> [ClientInfo] -> [Handle]
    35 fromRoomHandles :: String -> [ClientInfo] -> [Handle]
    33 fromRoomHandles roomName clients = map (\ci -> handle ci) $ filter (\ci -> room ci == roomName) clients
    36 fromRoomHandles roomName clients = map (\ci -> handle ci) $ filter (\ci -> room ci == roomName) clients
    34 
    37 
    35 modifyClient :: Handle -> [ClientInfo] -> (ClientInfo -> ClientInfo) -> [ClientInfo]
    38 modifyClient :: Handle -> [ClientInfo] -> (ClientInfo -> ClientInfo) -> [ClientInfo]
    36 modifyClient clhandle (cl:cls) func =
    39 modifyClient clhandle (cl:cls) func =