netserver/HWProto.hs
changeset 1320 bffc7262e25e
parent 1317 13cf8c5a7428
child 1321 d7dc4e86201e
--- a/netserver/HWProto.hs	Wed Oct 08 15:55:23 2008 +0000
+++ b/netserver/HWProto.hs	Wed Oct 08 15:57:35 2008 +0000
@@ -4,7 +4,7 @@
 import Data.List
 import Data.Word
 import Miscutils
-import Maybe (fromMaybe, fromJust)
+import Maybe
 import qualified Data.Map as Map
 
 answerBadCmd = [(clientOnly, ["ERROR", "Bad command, state or incorrect parameter"])]
@@ -61,7 +61,7 @@
 	else
 		(modifyClient client{nick = newNick}, noChangeRooms, answerNick newNick)
 	where
-		haveSameNick = not . null $ filter (\cl -> newNick == nick cl) clients
+		haveSameNick = isJust $ find (\cl -> newNick == nick cl) clients
 
 handleCmd_noInfo client _ _ ["PROTO", protoNum] =
 	if protocol client > 0 then
@@ -87,7 +87,7 @@
 	else
 		(modifyClient client{room = newRoom, isMaster = True}, addRoom (RoomInfo newRoom roomPassword (protocol client) [] Map.empty), answerJoined $ nick client)
 	where
-		haveSameRoom = not . null $ filter (\room -> newRoom == name room) rooms
+		haveSameRoom = isJust $ find (\room -> newRoom == name room) rooms
 
 handleCmd_noRoom client clients rooms ["CREATE", newRoom] =
 	handleCmd_noRoom client clients rooms ["CREATE", newRoom, ""]
@@ -100,7 +100,7 @@
 	else
 		(modifyClient client{room = roomName}, noChangeRooms, (answerJoined $ nick client) ++ answerNicks ++ answerFullConfig joinRoom)
 	where
-		noSuchRoom = null $ filter (\room -> roomName == name room) rooms
+		noSuchRoom = isNothing $ find (\room -> roomName == name room) rooms
 		answerNicks = [(clientOnly, ["JOINED"] ++ (map nick $ filter (\ci -> room ci == roomName) clients))]
 		joinRoom = roomByName roomName rooms