gameServer/HWProtoCore.hs
changeset 10195 d1c23bb73346
parent 10194 7025bd3c3131
child 10212 5fb3bb2de9d2
equal deleted inserted replaced
10194:7025bd3c3131 10195:d1c23bb73346
    34         return [ModifyClient (\c -> c{pingsQueue = pingsQueue c - 1})]
    34         return [ModifyClient (\c -> c{pingsQueue = pingsQueue c - 1})]
    35 
    35 
    36 handleCmd ["CMD", parameters] = uncurry h $ extractParameters parameters
    36 handleCmd ["CMD", parameters] = uncurry h $ extractParameters parameters
    37     where
    37     where
    38         h "DELEGATE" n | not $ B.null n = handleCmd ["DELEGATE", n]
    38         h "DELEGATE" n | not $ B.null n = handleCmd ["DELEGATE", n]
       
    39         h "SAVEROOM" n | not $ B.null n = handleCmd ["SAVEROOM", n]
       
    40         h "LOADROOM" n | not $ B.null n = handleCmd ["LOADROOM", n]
    39         h "SAVE" n | not $ B.null n = handleCmd ["SAVE", n]
    41         h "SAVE" n | not $ B.null n = handleCmd ["SAVE", n]
    40         h "DELETE" n | not $ B.null n = handleCmd ["DELETE", n]
    42         h "DELETE" n | not $ B.null n = handleCmd ["DELETE", n]
    41         h "STATS" _ = handleCmd ["STATS"]
    43         h "STATS" _ = handleCmd ["STATS"]
    42         h "PART" m | not $ B.null m = handleCmd ["PART", m]
    44         h "PART" m | not $ B.null m = handleCmd ["PART", m]
    43                    | otherwise = handleCmd ["PART"]
    45                    | otherwise = handleCmd ["PART"]
    55         h "GREETING" msg = handleCmd ["GREETING", msg]
    57         h "GREETING" msg = handleCmd ["GREETING", msg]
    56         h "CALLVOTE" msg | B.null msg = handleCmd ["CALLVOTE"]
    58         h "CALLVOTE" msg | B.null msg = handleCmd ["CALLVOTE"]
    57                          | otherwise = let (c, p) = extractParameters msg in
    59                          | otherwise = let (c, p) = extractParameters msg in
    58                                            if B.null p then handleCmd ["CALLVOTE", c] else handleCmd ["CALLVOTE", c, p]
    60                                            if B.null p then handleCmd ["CALLVOTE", c] else handleCmd ["CALLVOTE", c, p]
    59         h "VOTE" msg = handleCmd ["VOTE", upperCase msg]
    61         h "VOTE" msg = handleCmd ["VOTE", upperCase msg]
    60         h c p = return [Warning $ B.concat ["Unknown cmd: /", c, p]]
    62         h c p = return [Warning $ B.concat ["Unknown cmd: /", c, " ", p]]
    61 
    63 
    62         extractParameters p = let (a, b) = B.break (== ' ') p in (upperCase a, B.dropWhile (== ' ') b)
    64         extractParameters p = let (a, b) = B.break (== ' ') p in (upperCase a, B.dropWhile (== ' ') b)
    63 
    65 
    64 
    66 
    65 handleCmd cmd = do
    67 handleCmd cmd = do