Global notice with /global command. Can now warn users when doing server restart.
authorunc0rr
Fri, 22 Feb 2013 23:21:13 +0400
changeset 8547 6898be8aa261
parent 8545 1385ab7219d9
child 8550 17378d33e62e
Global notice with /global command. Can now warn users when doing server restart.
gameServer/HWProtoCore.hs
--- a/gameServer/HWProtoCore.hs	Fri Feb 22 11:35:54 2013 +0400
+++ b/gameServer/HWProtoCore.hs	Fri Feb 22 23:21:13 2013 +0400
@@ -34,8 +34,8 @@
         else
         return [ModifyClient (\c -> c{pingsQueue = pingsQueue c - 1})]
 
-handleCmd ("CMD" : params) =
-    let c = concatMap B.words params in
+handleCmd ("CMD" : parameters) =
+    let c = concatMap B.words parameters in
         if not $ null c then
             h $ (upperCase . head $ c) : tail c
             else
@@ -45,6 +45,10 @@
         h ["STATS"] = handleCmd ["STATS"]
         h ["PART", msg] = handleCmd ["PART", msg]
         h ["QUIT", msg] = handleCmd ["QUIT", msg]
+        h ["GLOBAL", msg] = do
+            rnc <- liftM snd ask
+            let chans = map (sendChan . client rnc) $ allClients rnc
+            return [AnswerClients chans ["CHAT", "[global notice]", msg]]
         h c = return [Warning . B.concat . L.intersperse " " $ "Unknown cmd" : c]
 
 handleCmd cmd = do