79 | otherwise = handleCmd ["QUIT"] |
80 | otherwise = handleCmd ["QUIT"] |
80 h "RND" p = handleCmd ("RND" : B.words p) |
81 h "RND" p = handleCmd ("RND" : B.words p) |
81 h "GLOBAL" p = serverAdminOnly $ do |
82 h "GLOBAL" p = serverAdminOnly $ do |
82 rnc <- liftM snd ask |
83 rnc <- liftM snd ask |
83 let chans = map (sendChan . client rnc) $ allClients rnc |
84 let chans = map (sendChan . client rnc) $ allClients rnc |
84 -- parenthesis instead of square brackets used to avoid accidental translation by frontend |
85 return [AnswerClients chans ["CHAT", nickGlobal, p]] |
85 return [AnswerClients chans ["CHAT", "(global notice)", p]] |
|
86 h "WATCH" f = return [QueryReplay f] |
86 h "WATCH" f = return [QueryReplay f] |
87 h "FIX" _ = handleCmd ["FIX"] |
87 h "FIX" _ = handleCmd ["FIX"] |
88 h "UNFIX" _ = handleCmd ["UNFIX"] |
88 h "UNFIX" _ = handleCmd ["UNFIX"] |
89 h "GREETING" msg | not $ B.null msg = handleCmd ["GREETING", msg] |
89 h "GREETING" msg | not $ B.null msg = handleCmd ["GREETING", msg] |
90 h "CALLVOTE" msg | B.null msg = handleCmd ["CALLVOTE"] |
90 h "CALLVOTE" msg | B.null msg = handleCmd ["CALLVOTE"] |
103 h "REGISTERED_ONLY" _ = serverAdminOnly $ do |
103 h "REGISTERED_ONLY" _ = serverAdminOnly $ do |
104 cl <- thisClient |
104 cl <- thisClient |
105 return |
105 return |
106 [ModifyServerInfo(\s -> s{isRegisteredUsersOnly = not $ isRegisteredUsersOnly s}) |
106 [ModifyServerInfo(\s -> s{isRegisteredUsersOnly = not $ isRegisteredUsersOnly s}) |
107 -- TODO: Say whether 'registered only' state is on or off |
107 -- TODO: Say whether 'registered only' state is on or off |
108 , AnswerClients [sendChan cl] ["CHAT", "[server]", loc "'Registered only' state toggled."] |
108 , AnswerClients [sendChan cl] ["CHAT", nickServer, loc "'Registered only' state toggled."] |
109 ] |
109 ] |
110 h "SUPER_POWER" _ = serverAdminOnly $ do |
110 h "SUPER_POWER" _ = serverAdminOnly $ do |
111 cl <- thisClient |
111 cl <- thisClient |
112 return |
112 return |
113 [ModifyClient (\c -> c{hasSuperPower = True}) |
113 [ModifyClient (\c -> c{hasSuperPower = True}) |
114 , AnswerClients [sendChan cl] ["CHAT", "[server]", loc "Super power activated."] |
114 , AnswerClients [sendChan cl] ["CHAT", nickServer, loc "Super power activated."] |
115 ] |
115 ] |
116 h _ _ = return [Warning $ loc "Unknown command or invalid parameters. Say '/help' in chat for a list of commands." ] |
116 h _ _ = return [Warning $ loc "Unknown command or invalid parameters. Say '/help' in chat for a list of commands." ] |
117 |
117 |
118 |
118 |
119 extractParameters p = let (a, b) = B.break (== ' ') p in (upperCase a, B.dropWhile (== ' ') b) |
119 extractParameters p = let (a, b) = B.break (== ' ') p in (upperCase a, B.dropWhile (== ' ') b) |
134 if teamsInGame cl > 0 then (loc "(playing)") else (loc "(spectating)") |
134 if teamsInGame cl > 0 then (loc "(playing)") else (loc "(spectating)") |
135 else |
135 else |
136 "" |
136 "" |
137 let hostStr = if isAdminAsking then host cl else B.empty |
137 let hostStr = if isAdminAsking then host cl else B.empty |
138 if noSuchClient then |
138 if noSuchClient then |
139 answerClient [ "CHAT", "[server]", loc "Player is not online." ] |
139 answerClient [ "CHAT", nickServer, loc "Player is not online." ] |
140 else |
140 else |
141 answerClient [ |
141 answerClient [ |
142 "INFO", |
142 "INFO", |
143 nick cl, |
143 nick cl, |
144 B.concat ["[", hostStr, "]"], |
144 B.concat ["[", hostStr, "]"], |