netserver/Miscutils.hs
changeset 902 3cc10f0aae37
parent 901 2f5ce9a584f9
child 1082 596b1dcdc1df
--- a/netserver/Miscutils.hs	Sun May 04 13:49:55 2008 +0000
+++ b/netserver/Miscutils.hs	Sun May 04 14:07:26 2008 +0000
@@ -29,6 +29,9 @@
 clientByHandle :: Handle -> [ClientInfo] -> ClientInfo
 clientByHandle clhandle clients = fromJust $ find (\ci -> handle ci == clhandle) clients
 
+roomByName :: String -> [RoomInfo] -> RoomInfo
+roomByName roomName rooms = fromJust $ find (\room -> roomName == name room) rooms
+
 fromRoomHandles :: String -> [ClientInfo] -> [Handle]
 fromRoomHandles roomName clients = map (\ci -> handle ci) $ filter (\ci -> room ci == roomName) clients