gameServer/HWProtoCore.hs
changeset 11472 f2c36df8c7b1
parent 11471 4b5c7a5c49fd
child 11580 db7743e2fad1
--- a/gameServer/HWProtoCore.hs	Mon Dec 28 21:51:12 2015 +0300
+++ b/gameServer/HWProtoCore.hs	Mon Dec 28 23:37:44 2015 +0300
@@ -75,11 +75,10 @@
         h "QUIT" m | not $ B.null m = handleCmd ["QUIT", m]
                    | otherwise = handleCmd ["QUIT"]
         h "RND" p = handleCmd ("RND" : B.words p)
-        h "GLOBAL" p = do
-            cl <- thisClient
+        h "GLOBAL" p = serverAdminOnly $ do
             rnc <- liftM snd ask
             let chans = map (sendChan . client rnc) $ allClients rnc
-            return [AnswerClients chans ["CHAT", "[global notice]", p] | isAdministrator cl]
+            return [AnswerClients chans ["CHAT", "[global notice]", p]]
         h "WATCH" f = return [QueryReplay f]
         h "FIX" _ = handleCmd ["FIX"]
         h "UNFIX" _ = handleCmd ["UNFIX"]
@@ -92,14 +91,13 @@
         h "MAXTEAMS" n | not $ B.null n = handleCmd ["MAXTEAMS", n]
         h "INFO" n | not $ B.null n = handleCmd ["INFO", n]
         h "RESTART_SERVER" "YES" = handleCmd ["RESTART_SERVER"]
-        h "REGISTERED_ONLY" _ = do
+        h "REGISTERED_ONLY" _ = serverAdminOnly $ do
             cl <- thisClient
-            return $ if isAdministrator cl then 
+            return
                 [ModifyServerInfo(\s -> s{isRegisteredUsersOnly = not $ isRegisteredUsersOnly s})
                 , AnswerClients [sendChan cl] ["CHAT", "[server]", "'Registered only' state toggled"]
                 ]
-                else
-                []
+        h "SUPER_POWER" _ = serverAdminOnly $ return [ModifyClient (\c -> c{hasSuperPower = True})]
         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)