netserver/hwserv.hs
changeset 852 f756a1d3324c
parent 851 8ffa4ad0d8ea
--- a/netserver/hwserv.hs	Sat Apr 19 19:29:58 2008 +0000
+++ b/netserver/hwserv.hs	Sat Apr 19 19:34:19 2008 +0000
@@ -16,8 +16,8 @@
 		return ()
 
 handleCmd clientHandle clientsList roomsList ("CREATE", [roomname]) = do
-		manipState2 clientsList roomsList (hcCreate)
-		sendMsg clientHandle ("JOINED " ++ roomname)
+		res <- manipState2 clientsList roomsList (hcCreate)
+		if res then sendMsg clientHandle ("JOINED " ++ roomname) else sendMsg clientHandle "Already exists"
 		where
 			hcCreate ci ri = if (null $ filter (\ xr -> roomname == name xr) ri) then
 				(map
@@ -27,9 +27,9 @@
 							else
 								xc)
 					ci,
-					(RoomInfo roomname "") : ri)
+					(RoomInfo roomname "") : ri, True)
 				else
-					(ci, ri)
+					(ci, ri, False)
 
 handleCmd clientHandle clientsList roomsList ("LIST", []) = do
 		rl <- atomically $ readTVar roomsList