netserver/newhwserv.hs
changeset 1308 d5dcd6cfa5e2
parent 1307 ce26e16d18ab
child 1309 1a38a967bd48
--- a/netserver/newhwserv.hs	Mon Oct 06 18:07:38 2008 +0000
+++ b/netserver/newhwserv.hs	Mon Oct 06 18:37:47 2008 +0000
@@ -7,6 +7,7 @@
 import Control.Concurrent.STM
 import Control.Exception (setUncaughtExceptionHandler, handle, finally)
 import Control.Monad (forM, forM_, filterM, liftM)
+import Maybe (fromMaybe)
 import Data.List
 import Miscutils
 import HWProto
@@ -69,8 +70,10 @@
 
 			let (clientsFunc, roomsFunc, answers) = handleCmd client clients rooms $ cmd
 			let mrooms = roomsFunc rooms
+			let mclients = (clientsFunc clients)
+			let mclient = fromMaybe client $ find (== client) mclients
 
-			clientsIn <- sendAnswers answers client (clientsFunc clients) mrooms
+			clientsIn <- sendAnswers answers mclient mclients mrooms
 			
 			mainLoop servSock acceptChan clientsIn mrooms