gameServer/HWProtoCore.hs
changeset 8547 6898be8aa261
parent 8519 98e2dbdda8c0
child 8897 d6c310c65c91
equal deleted inserted replaced
8545:1385ab7219d9 8547:6898be8aa261
    32     if pingsQueue cl == 0 then
    32     if pingsQueue cl == 0 then
    33         return $ actionsPending cl ++ [ModifyClient (\c -> c{actionsPending = []})]
    33         return $ actionsPending cl ++ [ModifyClient (\c -> c{actionsPending = []})]
    34         else
    34         else
    35         return [ModifyClient (\c -> c{pingsQueue = pingsQueue c - 1})]
    35         return [ModifyClient (\c -> c{pingsQueue = pingsQueue c - 1})]
    36 
    36 
    37 handleCmd ("CMD" : params) =
    37 handleCmd ("CMD" : parameters) =
    38     let c = concatMap B.words params in
    38     let c = concatMap B.words parameters in
    39         if not $ null c then
    39         if not $ null c then
    40             h $ (upperCase . head $ c) : tail c
    40             h $ (upperCase . head $ c) : tail c
    41             else
    41             else
    42             return []
    42             return []
    43     where
    43     where
    44         h ["DELEGATE", n] = handleCmd ["DELEGATE", n]
    44         h ["DELEGATE", n] = handleCmd ["DELEGATE", n]
    45         h ["STATS"] = handleCmd ["STATS"]
    45         h ["STATS"] = handleCmd ["STATS"]
    46         h ["PART", msg] = handleCmd ["PART", msg]
    46         h ["PART", msg] = handleCmd ["PART", msg]
    47         h ["QUIT", msg] = handleCmd ["QUIT", msg]
    47         h ["QUIT", msg] = handleCmd ["QUIT", msg]
       
    48         h ["GLOBAL", msg] = do
       
    49             rnc <- liftM snd ask
       
    50             let chans = map (sendChan . client rnc) $ allClients rnc
       
    51             return [AnswerClients chans ["CHAT", "[global notice]", msg]]
    48         h c = return [Warning . B.concat . L.intersperse " " $ "Unknown cmd" : c]
    52         h c = return [Warning . B.concat . L.intersperse " " $ "Unknown cmd" : c]
    49 
    53 
    50 handleCmd cmd = do
    54 handleCmd cmd = do
    51     (ci, irnc) <- ask
    55     (ci, irnc) <- ask
    52     let cl = irnc `client` ci
    56     let cl = irnc `client` ci