145 [] |
145 [] |
146 else |
146 else |
147 BanClient banNick : handleCmd_lobby clID clients rooms ["KICK", banNick] |
147 BanClient banNick : handleCmd_lobby clID clients rooms ["KICK", banNick] |
148 where |
148 where |
149 client = clients IntMap.! clID |
149 client = clients IntMap.! clID |
|
150 -} |
150 |
151 |
151 |
152 |
|
153 handleCmd_lobby ["SET_SERVER_VAR", "MOTD_NEW", newMessage] = do |
|
154 cl <- thisClient |
|
155 return [ModifyServerInfo (\si -> si{serverMessage = newMessage}) | isAdministrator cl] |
152 |
156 |
153 handleCmd_lobby clID clients rooms ["SET_SERVER_VAR", "MOTD_NEW", newMessage] = |
157 handleCmd_lobby ["SET_SERVER_VAR", "MOTD_OLD", newMessage] = do |
154 [ModifyServerInfo (\si -> si{serverMessage = newMessage}) | isAdministrator client] |
158 cl <- thisClient |
|
159 return [ModifyServerInfo (\si -> si{serverMessageForOldVersions = newMessage}) | isAdministrator cl] |
|
160 |
|
161 handleCmd_lobby ["SET_SERVER_VAR", "LATEST_PROTO", protoNum] = do |
|
162 cl <- thisClient |
|
163 return [ModifyServerInfo (\si -> si{latestReleaseVersion = readNum}) | isAdministrator cl && readNum > 0] |
155 where |
164 where |
156 client = clients IntMap.! clID |
165 readNum = case B.readInt protoNum of |
|
166 Just (i, t) | B.null t -> fromIntegral i |
|
167 otherwise -> 0 |
157 |
168 |
158 handleCmd_lobby clID clients rooms ["SET_SERVER_VAR", "MOTD_OLD", newMessage] = |
169 handleCmd_lobby ["GET_SERVER_VAR"] = do |
159 [ModifyServerInfo (\si -> si{serverMessageForOldVersions = newMessage}) | isAdministrator client] |
170 cl <- thisClient |
160 where |
171 return [SendServerVars | isAdministrator cl] |
161 client = clients IntMap.! clID |
|
162 |
172 |
163 handleCmd_lobby clID clients rooms ["SET_SERVER_VAR", "LATEST_PROTO", protoNum] = |
173 handleCmd_lobby ["CLEAR_ACCOUNTS_CACHE"] = do |
164 [ModifyServerInfo (\si -> si{latestReleaseVersion = fromJust readNum}) | isAdministrator client && isJust readNum] |
174 cl <- thisClient |
165 where |
175 return [ClearAccountsCache | isAdministrator cl] |
166 client = clients IntMap.! clID |
|
167 readNum = maybeRead protoNum :: Maybe Word16 |
|
168 |
|
169 handleCmd_lobby clID clients rooms ["GET_SERVER_VAR"] = |
|
170 [SendServerVars | isAdministrator client] |
|
171 where |
|
172 client = clients IntMap.! clID |
|
173 |
|
174 |
|
175 handleCmd_lobby clID clients rooms ["CLEAR_ACCOUNTS_CACHE"] = |
|
176 [ClearAccountsCache | isAdministrator client] |
|
177 where |
|
178 client = clients IntMap.! clID |
|
179 -} |
|
180 |
176 |
181 |
177 |
182 handleCmd_lobby _ = return [ProtocolError "Incorrect command (state: in lobby)"] |
178 handleCmd_lobby _ = return [ProtocolError "Incorrect command (state: in lobby)"] |