gameServer/HWProtoNEState.hs
changeset 3541 f4f90987e0fa
parent 3536 7d99655130ff
child 3538 b11ac2677e42
equal deleted inserted replaced
3535:9e78c1f3d8d8 3541:f4f90987e0fa
    29                     AnswerClients [sendChan cl] ["NICK", newNick] :
    29                     AnswerClients [sendChan cl] ["NICK", newNick] :
    30                     [CheckRegistered | clientProto cl /= 0]
    30                     [CheckRegistered | clientProto cl /= 0]
    31     where
    31     where
    32         haveSameNick irnc = False --isJust $ find (\cl -> newNick == nick cl) $ IntMap.elems clients
    32         haveSameNick irnc = False --isJust $ find (\cl -> newNick == nick cl) $ IntMap.elems clients
    33 
    33 
       
    34 
    34 handleCmd_NotEntered ["PROTO", protoNum] = do
    35 handleCmd_NotEntered ["PROTO", protoNum] = do
    35     (ci, irnc) <- ask
    36     (ci, irnc) <- ask
    36     let cl = irnc `client` ci
    37     let cl = irnc `client` ci
    37     if clientProto cl > 0 then return [ProtocolError "Protocol already known"]
    38     if clientProto cl > 0 then return [ProtocolError "Protocol already known"]
    38         else 
    39         else 
    45     where
    46     where
    46         parsedProto = case B.readInt protoNum of
    47         parsedProto = case B.readInt protoNum of
    47                            Just (i, t) | B.null t -> fromIntegral i
    48                            Just (i, t) | B.null t -> fromIntegral i
    48                            otherwise -> 0
    49                            otherwise -> 0
    49 
    50 
       
    51 
       
    52 handleCmd_NotEntered ["PASSWORD", passwd] = do
       
    53     (ci, irnc) <- ask
       
    54     let cl = irnc `client` ci
       
    55 
       
    56     if passwd == webPassword cl then
       
    57         return $ JoinLobby : [AnswerClients [sendChan cl] ["ADMIN_ACCESS"] | isAdministrator cl]
       
    58         else
       
    59         return [ByeClient "Authentication failed"]
       
    60 
    50 {-
    61 {-
    51 
       
    52 handleCmd_NotEntered clID clients _ ["PASSWORD", passwd] =
       
    53     if passwd == webPassword client then
       
    54         [ModifyClient (\cl -> cl{logonPassed = True}),
       
    55         MoveToLobby] ++ adminNotice
       
    56     else
       
    57         [ByeClient "Authentication failed"]
       
    58     where
       
    59         client = clients IntMap.! clID
       
    60         adminNotice = [AnswerThisClient ["ADMIN_ACCESS"] | isAdministrator client]
       
    61 
       
    62 
    62 
    63 handleCmd_NotEntered clID clients _ ["DUMP"] =
    63 handleCmd_NotEntered clID clients _ ["DUMP"] =
    64     if isAdministrator (clients IntMap.! clID) then [Dump] else []
    64     if isAdministrator (clients IntMap.! clID) then [Dump] else []
    65 -}
    65 -}
    66 
    66