gameServer/ServerCore.hs
changeset 3742 8461f0cef2e6
parent 3741 73246d25dfe1
child 3947 709fdb89f76c
--- a/gameServer/ServerCore.hs	Sun Aug 15 10:25:21 2010 -0400
+++ b/gameServer/ServerCore.hs	Tue Aug 17 19:43:17 2010 -0400
@@ -7,7 +7,7 @@
 import qualified Data.IntMap as IntMap
 import System.Log.Logger
 import Control.Monad.Reader
-import Control.Monad.State
+import Control.Monad.State.Strict
 import Data.Set as Set
 import qualified Data.ByteString.Char8 as B
 --------------------------------------
@@ -19,7 +19,7 @@
 import ServerState
 
 
-timerLoop :: Int -> Chan CoreMessage -> IO()
+timerLoop :: Int -> Chan CoreMessage -> IO ()
 timerLoop tick messagesChan = threadDelay (30 * 10^6) >> writeChan messagesChan (TimerAction tick) >> timerLoop (tick + 1) messagesChan
 
 
@@ -57,13 +57,13 @@
                 --return (serverInfo, rnc)
 
         ClientAccountInfo (ci, info) -> do
-            --should instead check ci exists and has same nick/hostname
-            --removed <- gets removedClients
-            --when (not $ ci `Set.member` removed) $ do
-            --    modify (\as -> as{clientIndex = Just ci})
-            --    processAction (ProcessAccountInfo info)
-            return ()
-            
+            rnc <- gets roomsClients
+            exists <- liftIO $ clientExists rnc ci
+            when (exists) $ do
+                modify (\as -> as{clientIndex = Just ci})
+                processAction (ProcessAccountInfo info)
+                return ()
+
         TimerAction tick ->
                 mapM_ processAction $
                     PingAll : [StatsAction | even tick]