--- a/gameServer/HWProtoCore.hs Tue Jan 21 21:16:52 2014 +0100
+++ b/gameServer/HWProtoCore.hs Wed Jan 22 01:11:13 2014 +0400
@@ -33,10 +33,7 @@
else
return [ModifyClient (\c -> c{pingsQueue = pingsQueue c - 1})]
-handleCmd ["CMD", parameters] = do
- let (cmd, plist) = B.break (== ' ') parameters
- let param = B.dropWhile (== ' ') plist
- h (upperCase cmd) param
+handleCmd ["CMD", parameters] = uncurry h $ extractParameters parameters
where
h "DELEGATE" n | not $ B.null n = handleCmd ["DELEGATE", n]
h "STATS" _ = handleCmd ["STATS"]
@@ -54,8 +51,15 @@
h "FIX" _ = handleCmd ["FIX"]
h "UNFIX" _ = handleCmd ["UNFIX"]
h "GREETING" msg = handleCmd ["GREETING", msg]
+ h "CALLVOTE" msg | B.null msg = handleCmd ["CALLVOTE"]
+ | otherwise = let (c, p) = extractParameters msg in
+ if B.null p then handleCmd ["CALLVOTE", c] else handleCmd ["CALLVOTE", c, p]
+ h "VOTE" msg = handleCmd ["VOTE", upperCase msg]
h c p = return [Warning $ B.concat ["Unknown cmd: /", c, p]]
+ extractParameters p = let (a, b) = B.break (== ' ') p in (upperCase a, B.dropWhile (== ' ') b)
+
+
handleCmd cmd = do
(ci, irnc) <- ask
let cl = irnc `client` ci