author | koda |
Wed, 12 Jun 2013 01:02:33 +0200 | |
changeset 9203 | bcc25cb9b122 |
parent 9109 | 878f06e9c484 |
child 9303 | 457efde100b5 |
permissions | -rw-r--r-- |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
1 |
{-# LANGUAGE OverloadedStrings #-} |
1804 | 2 |
module HWProtoLobbyState where |
3 |
||
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
4 |
import Data.Maybe |
1804 | 5 |
import Data.List |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
6 |
import Control.Monad.Reader |
1804 | 7 |
-------------------------------------- |
8 |
import CoreTypes |
|
9 |
import Actions |
|
10 |
import Utils |
|
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
11 |
import HandlerUtils |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
12 |
import RoomsAndClients |
6068 | 13 |
import EngineInteraction |
1804 | 14 |
|
4932 | 15 |
|
4989 | 16 |
answerAllTeams :: ClientInfo -> [TeamInfo] -> [Action] |
4591 | 17 |
answerAllTeams cl = concatMap toAnswer |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
18 |
where |
4591 | 19 |
clChan = sendChan cl |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
20 |
toAnswer team = |
4591 | 21 |
[AnswerClients [clChan] $ teamToNet team, |
22 |
AnswerClients [clChan] ["TEAM_COLOR", teamname team, teamcolor team], |
|
5030
42746c5d4a80
Changed the standard show function to Text.Show.ByteString, and misc.
EJ <eivind.jahren@gmail.com>
parents:
4989
diff
changeset
|
23 |
AnswerClients [clChan] ["HH_NUM", teamname team, showB $ hhnum team]] |
4568 | 24 |
|
6541
08ed346ed341
Send full room info on room add and update events. Less(?) traffic, but current frontend doesn't behave good with this change to server.
unc0rr
parents:
6191
diff
changeset
|
25 |
|
4989 | 26 |
handleCmd_lobby :: CmdHandler |
1804 | 27 |
|
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
28 |
|
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
29 |
handleCmd_lobby ["LIST"] = do |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
30 |
(ci, irnc) <- ask |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
31 |
let cl = irnc `client` ci |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
32 |
rooms <- allRoomInfos |
6541
08ed346ed341
Send full room info on room add and update events. Less(?) traffic, but current frontend doesn't behave good with this change to server.
unc0rr
parents:
6191
diff
changeset
|
33 |
let roomsInfoList = concatMap (\r -> roomInfo (nick $ irnc `client` masterID r) r) . filter (\r -> (roomProto r == clientProto cl)) |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
34 |
return [AnswerClients [sendChan cl] ("ROOMS" : roomsInfoList rooms)] |
3501 | 35 |
|
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
36 |
|
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
37 |
handleCmd_lobby ["CHAT", msg] = do |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
38 |
n <- clientNick |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
39 |
s <- roomOthersChans |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
40 |
return [AnswerClients s ["CHAT", n, msg]] |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
41 |
|
4932 | 42 |
handleCmd_lobby ["CREATE_ROOM", rName, roomPassword] |
8401
87410ae372f6
Server messages localization using Qt's l10n subsystem:
unc0rr
parents:
8369
diff
changeset
|
43 |
| illegalName rName = return [Warning $ loc "Illegal room name"] |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
44 |
| otherwise = do |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
45 |
rs <- allRoomInfos |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
46 |
cl <- thisClient |
4932 | 47 |
return $ if isJust $ find (\r -> rName == name r) rs then |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
48 |
[Warning "Room exists"] |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
49 |
else |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
50 |
[ |
7775 | 51 |
AddRoom rName roomPassword |
52 |
, AnswerClients [sendChan cl] ["CLIENT_FLAGS", "+hr", nick cl] |
|
9109
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9035
diff
changeset
|
53 |
, ModifyClient (\c -> c{isMaster = True, isReady = True, isJoinedMidGame = False}) |
7775 | 54 |
, ModifyRoom (\r -> r{readyPlayers = 1}) |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
55 |
] |
1804 | 56 |
|
3536 | 57 |
|
4932 | 58 |
handleCmd_lobby ["CREATE_ROOM", rName] = |
59 |
handleCmd_lobby ["CREATE_ROOM", rName, ""] |
|
3536 | 60 |
|
1862 | 61 |
|
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
62 |
handleCmd_lobby ["JOIN_ROOM", roomName, roomPassword] = do |
4932 | 63 |
(_, irnc) <- ask |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
64 |
let ris = allRooms irnc |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
65 |
cl <- thisClient |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
66 |
let maybeRI = find (\ri -> roomName == name (irnc `room` ri)) ris |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
67 |
let jRI = fromJust maybeRI |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
68 |
let jRoom = irnc `room` jRI |
5931 | 69 |
let sameProto = clientProto cl == roomProto jRoom |
4597
31e042ab870c
Finally a solution for excess lazyness when working with unsafeThaw'ed arrays
unc0rr
parents:
4595
diff
changeset
|
70 |
let jRoomClients = map (client irnc) $ roomClients irnc jRI |
31e042ab870c
Finally a solution for excess lazyness when working with unsafeThaw'ed arrays
unc0rr
parents:
4595
diff
changeset
|
71 |
let nicks = map nick jRoomClients |
7682 | 72 |
let ownerNick = nick . fromJust $ find isMaster jRoomClients |
4597
31e042ab870c
Finally a solution for excess lazyness when working with unsafeThaw'ed arrays
unc0rr
parents:
4595
diff
changeset
|
73 |
let chans = map sendChan (cl : jRoomClients) |
7537
833a0c34fafc
Room bans. They're more simple, than the global ones: if you ban someone, he is banned by ip in this room for the rest of the room lifetime. Not tested.
unc0rr
parents:
7321
diff
changeset
|
74 |
let isBanned = host cl `elem` roomBansList jRoom |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
75 |
return $ |
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
6912
diff
changeset
|
76 |
if isNothing maybeRI || not sameProto then |
8401
87410ae372f6
Server messages localization using Qt's l10n subsystem:
unc0rr
parents:
8369
diff
changeset
|
77 |
[Warning $ loc "No such room"] |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
78 |
else if isRestrictedJoins jRoom then |
8401
87410ae372f6
Server messages localization using Qt's l10n subsystem:
unc0rr
parents:
8369
diff
changeset
|
79 |
[Warning $ loc "Joining restricted"] |
8232 | 80 |
else if isRegisteredOnly jRoom then |
8401
87410ae372f6
Server messages localization using Qt's l10n subsystem:
unc0rr
parents:
8369
diff
changeset
|
81 |
[Warning $ loc "Registered users only"] |
7537
833a0c34fafc
Room bans. They're more simple, than the global ones: if you ban someone, he is banned by ip in this room for the rest of the room lifetime. Not tested.
unc0rr
parents:
7321
diff
changeset
|
82 |
else if isBanned then |
8401
87410ae372f6
Server messages localization using Qt's l10n subsystem:
unc0rr
parents:
8369
diff
changeset
|
83 |
[Warning $ loc "You are banned in this room"] |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
84 |
else if roomPassword /= password jRoom then |
6912
831416764d2d
Allow LIST command while in room to not annoy old frontends (0.9.17 or less) with warnings
unc0rr
parents:
6541
diff
changeset
|
85 |
[NoticeMessage WrongPassword] |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
86 |
else |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
87 |
[ |
7682 | 88 |
MoveToRoom jRI |
9109
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9035
diff
changeset
|
89 |
, ModifyClient (\c -> c{isJoinedMidGame = isJust $ gameInfo jRoom}) |
7682 | 90 |
, AnswerClients [sendChan cl] $ "JOINED" : nicks |
91 |
, AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl] |
|
92 |
, AnswerClients [sendChan cl] $ ["CLIENT_FLAGS", "+h", ownerNick] |
|
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
93 |
] |
8235 | 94 |
++ (if clientProto cl < 38 then map (readynessMessage cl) jRoomClients else [sendStateFlags cl jRoomClients]) |
9109
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9035
diff
changeset
|
95 |
++ answerFullConfig cl jRoom |
8897
d6c310c65c91
- Revert server workaround over desync from r98e2dbdda8c0
unc0rr
parents:
8519
diff
changeset
|
96 |
++ answerTeams cl jRoom |
d6c310c65c91
- Revert server workaround over desync from r98e2dbdda8c0
unc0rr
parents:
8519
diff
changeset
|
97 |
++ watchRound cl jRoom chans |
1804 | 98 |
|
4587 | 99 |
where |
8235 | 100 |
readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c] |
101 |
sendStateFlags cl clients = AnswerClients [sendChan cl] . concat . intersperse [""] . filter (not . null) . concat $ |
|
102 |
[f "+r" ready, f "-r" unready, f "+g" ingame, f "-g" inroomlobby] |
|
103 |
where |
|
104 |
(ready, unready) = partition isReady clients |
|
105 |
(ingame, inroomlobby) = partition isInGame clients |
|
106 |
f fl lst = ["CLIENT_FLAGS" : fl : map nick lst | not $ null lst] |
|
3536 | 107 |
|
9109
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9035
diff
changeset
|
108 |
-- get config from gameInfo if possible, otherwise from room |
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9035
diff
changeset
|
109 |
answerFullConfig cl jRoom = let f r g = (if isJust $ gameInfo jRoom then g . fromJust . gameInfo else r) jRoom |
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9035
diff
changeset
|
110 |
in answerFullConfigParams cl (f mapParams giMapParams) (f params giParams) |
4587 | 111 |
|
5996
2c72fe81dd37
Convert boolean variable + a bunch of fields which make sense only while game is going on into Maybe + structure
unc0rr
parents:
5931
diff
changeset
|
112 |
answerTeams cl jRoom = let f = if isJust $ gameInfo jRoom then teamsAtStart . fromJust . gameInfo else teams in answerAllTeams cl $ f jRoom |
4591 | 113 |
|
8237 | 114 |
watchRound cl jRoom chans = if isNothing $ gameInfo jRoom then |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
115 |
[] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
116 |
else |
8237 | 117 |
[AnswerClients [sendChan cl] ["RUN_GAME"] |
118 |
, AnswerClients chans ["CLIENT_FLAGS", "+g", nick cl] |
|
119 |
, ModifyClient (\c -> c{isInGame = True}) |
|
8369 | 120 |
, AnswerClients [sendChan cl] $ "EM" : toEngineMsg "e$spectate 1" : (reverse . roundMsgs . fromJust . gameInfo $ jRoom)] |
1813 | 121 |
|
3536 | 122 |
|
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
123 |
handleCmd_lobby ["JOIN_ROOM", roomName] = |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
124 |
handleCmd_lobby ["JOIN_ROOM", roomName, ""] |
4568 | 125 |
|
1804 | 126 |
|
4616 | 127 |
handleCmd_lobby ["FOLLOW", asknick] = do |
128 |
(_, rnc) <- ask |
|
8486
9a65baafd7d7
Send JOINING message in response to FOLLOW. Actual join may still fail due to room restrictions. Not tested.
unc0rr
parents:
8403
diff
changeset
|
129 |
clChan <- liftM sendChan thisClient |
4616 | 130 |
ci <- clientByNick asknick |
131 |
let ri = clientRoom rnc $ fromJust ci |
|
8486
9a65baafd7d7
Send JOINING message in response to FOLLOW. Actual join may still fail due to room restrictions. Not tested.
unc0rr
parents:
8403
diff
changeset
|
132 |
let roomName = name $ room rnc ri |
5931 | 133 |
if isNothing ci || ri == lobbyId then |
4616 | 134 |
return [] |
135 |
else |
|
8486
9a65baafd7d7
Send JOINING message in response to FOLLOW. Actual join may still fail due to room restrictions. Not tested.
unc0rr
parents:
8403
diff
changeset
|
136 |
liftM ((:) (AnswerClients [clChan] ["JOINING", roomName])) $ handleCmd_lobby ["JOIN_ROOM", roomName] |
1862 | 137 |
|
9035
e84d42a4311c
'/rnd' command. Pass it a (possibly empty) list of items.
unc0rr
parents:
8897
diff
changeset
|
138 |
|
e84d42a4311c
'/rnd' command. Pass it a (possibly empty) list of items.
unc0rr
parents:
8897
diff
changeset
|
139 |
handleCmd_lobby ("RND":rs) = do |
e84d42a4311c
'/rnd' command. Pass it a (possibly empty) list of items.
unc0rr
parents:
8897
diff
changeset
|
140 |
c <- liftM sendChan thisClient |
e84d42a4311c
'/rnd' command. Pass it a (possibly empty) list of items.
unc0rr
parents:
8897
diff
changeset
|
141 |
return [Random [c] rs] |
e84d42a4311c
'/rnd' command. Pass it a (possibly empty) list of items.
unc0rr
parents:
8897
diff
changeset
|
142 |
|
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
143 |
--------------------------- |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
144 |
-- Administrator's stuff -- |
1862 | 145 |
|
4618 | 146 |
handleCmd_lobby ["KICK", kickNick] = do |
147 |
(ci, _) <- ask |
|
148 |
cl <- thisClient |
|
149 |
kickId <- clientByNick kickNick |
|
150 |
return [KickClient $ fromJust kickId | isAdministrator cl && isJust kickId && fromJust kickId /= ci] |
|
1866 | 151 |
|
4909 | 152 |
|
8156 | 153 |
handleCmd_lobby ["BAN", banNick, reason, duration] = do |
4909 | 154 |
(ci, _) <- ask |
155 |
cl <- thisClient |
|
156 |
banId <- clientByNick banNick |
|
8156 | 157 |
return [BanClient (readInt_ duration) reason (fromJust banId) | isAdministrator cl && isJust banId && fromJust banId /= ci] |
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
6912
diff
changeset
|
158 |
|
5426
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5209
diff
changeset
|
159 |
handleCmd_lobby ["BANIP", ip, reason, duration] = do |
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5209
diff
changeset
|
160 |
cl <- thisClient |
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5209
diff
changeset
|
161 |
return [BanIP ip (readInt_ duration) reason | isAdministrator cl] |
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
6912
diff
changeset
|
162 |
|
8154 | 163 |
handleCmd_lobby ["BANNICK", n, reason, duration] = do |
164 |
cl <- thisClient |
|
165 |
return [BanNick n (readInt_ duration) reason | isAdministrator cl] |
|
166 |
||
5426
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5209
diff
changeset
|
167 |
handleCmd_lobby ["BANLIST"] = do |
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5209
diff
changeset
|
168 |
cl <- thisClient |
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5209
diff
changeset
|
169 |
return [BanList | isAdministrator cl] |
1804 | 170 |
|
3283 | 171 |
|
7748 | 172 |
handleCmd_lobby ["UNBAN", entry] = do |
173 |
cl <- thisClient |
|
174 |
return [Unban entry | isAdministrator cl] |
|
175 |
||
176 |
||
4620 | 177 |
handleCmd_lobby ["SET_SERVER_VAR", "MOTD_NEW", newMessage] = do |
178 |
cl <- thisClient |
|
179 |
return [ModifyServerInfo (\si -> si{serverMessage = newMessage}) | isAdministrator cl] |
|
1925 | 180 |
|
4620 | 181 |
handleCmd_lobby ["SET_SERVER_VAR", "MOTD_OLD", newMessage] = do |
182 |
cl <- thisClient |
|
183 |
return [ModifyServerInfo (\si -> si{serverMessageForOldVersions = newMessage}) | isAdministrator cl] |
|
3260
b44b88908758
Allow to set motd for old client versions (not used yet, as server needs some refactoring)
unc0rr
parents:
2961
diff
changeset
|
184 |
|
4620 | 185 |
handleCmd_lobby ["SET_SERVER_VAR", "LATEST_PROTO", protoNum] = do |
186 |
cl <- thisClient |
|
187 |
return [ModifyServerInfo (\si -> si{latestReleaseVersion = readNum}) | isAdministrator cl && readNum > 0] |
|
3260
b44b88908758
Allow to set motd for old client versions (not used yet, as server needs some refactoring)
unc0rr
parents:
2961
diff
changeset
|
188 |
where |
5030
42746c5d4a80
Changed the standard show function to Text.Show.ByteString, and misc.
EJ <eivind.jahren@gmail.com>
parents:
4989
diff
changeset
|
189 |
readNum = readInt_ protoNum |
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
6912
diff
changeset
|
190 |
|
4620 | 191 |
handleCmd_lobby ["GET_SERVER_VAR"] = do |
192 |
cl <- thisClient |
|
193 |
return [SendServerVars | isAdministrator cl] |
|
3283 | 194 |
|
4620 | 195 |
handleCmd_lobby ["CLEAR_ACCOUNTS_CACHE"] = do |
196 |
cl <- thisClient |
|
197 |
return [ClearAccountsCache | isAdministrator cl] |
|
3283 | 198 |
|
5209
f7a610e2ef5f
On restart command close server socket and spawn new server, keep running until last client quits
unc0rr
parents:
5093
diff
changeset
|
199 |
handleCmd_lobby ["RESTART_SERVER"] = do |
4914 | 200 |
cl <- thisClient |
7537
833a0c34fafc
Room bans. They're more simple, than the global ones: if you ban someone, he is banned by ip in this room for the rest of the room lifetime. Not tested.
unc0rr
parents:
7321
diff
changeset
|
201 |
return [RestartServer | isAdministrator cl] |
4914 | 202 |
|
8403
fbc6e7602e05
- Allow server admins to use DELEGATE even when not room owner
unc0rr
parents:
8401
diff
changeset
|
203 |
handleCmd_lobby ["STATS"] = do |
fbc6e7602e05
- Allow server admins to use DELEGATE even when not room owner
unc0rr
parents:
8401
diff
changeset
|
204 |
cl <- thisClient |
fbc6e7602e05
- Allow server admins to use DELEGATE even when not room owner
unc0rr
parents:
8401
diff
changeset
|
205 |
return [Stats | isAdministrator cl] |
3283 | 206 |
|
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
207 |
handleCmd_lobby _ = return [ProtocolError "Incorrect command (state: in lobby)"] |