--- a/gameServer/Actions.hs Sat Dec 08 14:13:18 2018 +0100
+++ b/gameServer/Actions.hs Sat Dec 08 14:19:11 2018 +0100
@@ -885,3 +885,13 @@
processAction CheckVotes =
checkVotes >>= mapM_ processAction
+
+processAction (ShowRegisteredOnlyState chans) = do
+ si <- gets serverInfo
+ processAction $ AnswerClients chans
+ ["CHAT", nickServer,
+ if isRegisteredUsersOnly si then
+ loc "This server no longer allows unregistered players to join."
+ else
+ loc "This server now allows unregistered players to join."
+ ]
--- a/gameServer/CoreTypes.hs Sat Dec 08 14:13:18 2018 +0100
+++ b/gameServer/CoreTypes.hs Sat Dec 08 14:19:11 2018 +0100
@@ -103,6 +103,7 @@
| ReactCmd [B.ByteString]
| CheckVotes
| SetRandomSeed
+ | ShowRegisteredOnlyState [ClientChan]
data Event = LobbyChatMessage
--- a/gameServer/HWProtoCore.hs Sat Dec 08 14:13:18 2018 +0100
+++ b/gameServer/HWProtoCore.hs Sat Dec 08 14:19:11 2018 +0100
@@ -120,11 +120,11 @@
h "INFO" n | not $ B.null n = handleCmd ["INFO", n]
h "HELP" _ = handleCmd ["HELP"]
h "REGISTERED_ONLY" _ = serverAdminOnly $ do
- cl <- thisClient
+ rnc <- liftM snd ask
+ let chans = map (sendChan . client rnc) $ allClients rnc
return
[ModifyServerInfo(\s -> s{isRegisteredUsersOnly = not $ isRegisteredUsersOnly s})
- -- TODO: Say whether 'registered only' state is on or off
- , AnswerClients [sendChan cl] ["CHAT", nickServer, loc "'Registered only' state toggled."]
+ , ShowRegisteredOnlyState chans
]
h "SUPER_POWER" _ = serverAdminOnly $ do
cl <- thisClient