gameServer/Actions.hs
changeset 1839 5dd4cb7fd7e5
parent 1834 71cb978dc85f
child 1841 fba7210b438b
--- a/gameServer/Actions.hs	Tue Feb 24 19:39:10 2009 +0000
+++ b/gameServer/Actions.hs	Tue Feb 24 19:39:49 2009 +0000
@@ -5,6 +5,7 @@
 import Data.IntMap
 import qualified Data.IntSet as IntSet
 import qualified Data.Sequence as Seq
+import System.Log.Logger
 import Monad
 -----------------------------
 import CoreTypes
@@ -29,6 +30,7 @@
 	| ModifyRoom (RoomInfo -> RoomInfo)
 	| AddRoom String String
 	| CheckRegistered
+	| ProcessAccountInfo AccountInfo
 	| Dump
 
 type CmdHandler = Int -> Clients -> Rooms -> [String] -> [Action]
@@ -243,7 +245,7 @@
 
 
 processAction (clID, serverInfo, clients, rooms) (CheckRegistered) = do
-	writeChan (dbQueries serverInfo) $ HasRegistered $ nick client
+	writeChan (dbQueries serverInfo) $ CheckAccount clID (nick client)
 	return (clID, serverInfo, clients, rooms)
 	where
 		client = clients ! clID
@@ -252,3 +254,13 @@
 	writeChan (sendChan $ clients ! clID) ["DUMP", show serverInfo, showTree clients, showTree rooms]
 	return (clID, serverInfo, clients, rooms)
 
+processAction (clID, serverInfo, clients, rooms) (ProcessAccountInfo info) = do
+	case info of
+		HasAccount -> do
+			infoM "Clients" $ show clID ++ " has account"
+			writeChan (sendChan $ clients ! clID) ["ASKPASSWORD"]
+		LogonPassed -> do
+			infoM "Clients" $ show clID ++ " authenticated"
+		Guest -> do
+			infoM "Clients" $ show clID ++ " is guest"
+	return (clID, serverInfo, clients, rooms)