equal
deleted
inserted
replaced
1 {-# LANGUAGE OverloadedStrings #-} |
1 {-# LANGUAGE OverloadedStrings, CPP #-} |
2 module HWProtoNEState where |
2 module HWProtoNEState where |
3 |
3 |
4 import Control.Monad.Reader |
4 import Control.Monad.Reader |
5 import qualified Data.ByteString.Char8 as B |
5 import qualified Data.ByteString.Char8 as B |
6 -------------------------------------- |
6 -------------------------------------- |
46 return $ JoinLobby : [AnswerClients [sendChan cl] ["ADMIN_ACCESS"] | isAdministrator cl] |
46 return $ JoinLobby : [AnswerClients [sendChan cl] ["ADMIN_ACCESS"] | isAdministrator cl] |
47 else |
47 else |
48 return [ByeClient "Authentication failed"] |
48 return [ByeClient "Authentication failed"] |
49 |
49 |
50 |
50 |
|
51 #if defined(OFFICIAL_SERVER) |
51 handleCmd_NotEntered ["CHECKER", protoNum, newNick, password] = do |
52 handleCmd_NotEntered ["CHECKER", protoNum, newNick, password] = do |
52 (ci, irnc) <- ask |
53 (ci, irnc) <- ask |
53 let cl = irnc `client` ci |
54 let cl = irnc `client` ci |
54 |
55 |
55 if parsedProto == 0 then return [ProtocolError "Bad number"] |
56 if parsedProto == 0 then return [ProtocolError "Bad number"] |
57 return $ [ |
58 return $ [ |
58 ModifyClient (\c -> c{clientProto = parsedProto, nick = newNick, webPassword = password, isChecker = True}) |
59 ModifyClient (\c -> c{clientProto = parsedProto, nick = newNick, webPassword = password, isChecker = True}) |
59 , CheckRegistered] |
60 , CheckRegistered] |
60 where |
61 where |
61 parsedProto = readInt_ protoNum |
62 parsedProto = readInt_ protoNum |
62 |
63 #endif |
63 |
64 |
64 handleCmd_NotEntered _ = return [ProtocolError "Incorrect command (state: not entered)"] |
65 handleCmd_NotEntered _ = return [ProtocolError "Incorrect command (state: not entered)"] |