author | unc0rr |
Sun, 06 Jun 2010 15:29:33 +0000 | |
changeset 3500 | af8390d807d6 |
parent 3435 | 4e4f88a7bdf2 |
child 3501 | a3159a410e5c |
permissions | -rw-r--r-- |
3500
af8390d807d6
Use sockets instead of handles, use bytestrings instead of strings
unc0rr
parents:
3435
diff
changeset
|
1 |
{-# LANGUAGE OverloadedStrings #-} |
1804 | 2 |
module HWProtoLobbyState where |
3 |
||
4 |
import qualified Data.Map as Map |
|
5 |
import qualified Data.IntMap as IntMap |
|
6 |
import qualified Data.IntSet as IntSet |
|
1813 | 7 |
import qualified Data.Foldable as Foldable |
1804 | 8 |
import Maybe |
9 |
import Data.List |
|
3260
b44b88908758
Allow to set motd for old client versions (not used yet, as server needs some refactoring)
unc0rr
parents:
2961
diff
changeset
|
10 |
import Data.Word |
1804 | 11 |
-------------------------------------- |
12 |
import CoreTypes |
|
13 |
import Actions |
|
14 |
import Utils |
|
3435 | 15 |
import HandlerUtils |
1804 | 16 |
|
3435 | 17 |
{-answerAllTeams protocol teams = concatMap toAnswer teams |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
18 |
where |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
19 |
toAnswer team = |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
20 |
[AnswerThisClient $ teamToNet protocol team, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
21 |
AnswerThisClient ["TEAM_COLOR", teamname team, teamcolor team], |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
22 |
AnswerThisClient ["HH_NUM", teamname team, show $ hhnum team]] |
3435 | 23 |
-} |
1804 | 24 |
handleCmd_lobby :: CmdHandler |
25 |
||
3435 | 26 |
{- |
1804 | 27 |
handleCmd_lobby clID clients rooms ["LIST"] = |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
28 |
[AnswerThisClient ("ROOMS" : roomsInfoList)] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
29 |
where |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
30 |
roomsInfoList = concatMap roomInfo sameProtoRooms |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
31 |
sameProtoRooms = filter (\r -> (roomProto r == protocol) && not (isRestrictedJoins r)) roomsList |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
32 |
roomsList = IntMap.elems rooms |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
33 |
protocol = clientProto client |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
34 |
client = clients IntMap.! clID |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
35 |
roomInfo room |
3277 | 36 |
| clientProto client < 28 = [ |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
37 |
name room, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
38 |
show (playersIn room) ++ "(" ++ show (length $ teams room) ++ ")", |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
39 |
show $ gameinprogress room |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
40 |
] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
41 |
| otherwise = [ |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
42 |
show $ gameinprogress room, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
43 |
name room, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
44 |
show $ playersIn room, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
45 |
show $ length $ teams room, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
46 |
nick $ clients IntMap.! (masterID room), |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
47 |
head (Map.findWithDefault ["+gen+"] "MAP" (params room)), |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
48 |
head (Map.findWithDefault ["Default"] "SCHEME" (params room)), |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
49 |
head (Map.findWithDefault ["Default"] "AMMO" (params room)) |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
50 |
] |
3435 | 51 |
-} |
1862 | 52 |
|
3435 | 53 |
handleCmd_lobby ["CHAT", msg] = do |
54 |
n <- clientNick |
|
55 |
s <- roomOthersChans |
|
56 |
return [AnswerClients s ["CHAT", n, msg]] |
|
1804 | 57 |
|
3435 | 58 |
{- |
2352 | 59 |
handleCmd_lobby clID clients rooms ["CREATE_ROOM", newRoom, roomPassword] |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
60 |
| haveSameRoom = [Warning "Room exists"] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
61 |
| illegalName newRoom = [Warning "Illegal room name"] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
62 |
| otherwise = |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
63 |
[RoomRemoveThisClient "", -- leave lobby |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
64 |
AddRoom newRoom roomPassword, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
65 |
AnswerThisClient ["NOT_READY", clientNick] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
66 |
] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
67 |
where |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
68 |
clientNick = nick $ clients IntMap.! clID |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
69 |
haveSameRoom = isJust $ find (\room -> newRoom == name room) $ IntMap.elems rooms |
1804 | 70 |
|
1862 | 71 |
|
1905 | 72 |
handleCmd_lobby clID clients rooms ["CREATE_ROOM", newRoom] = |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
73 |
handleCmd_lobby clID clients rooms ["CREATE_ROOM", newRoom, ""] |
1804 | 74 |
|
1862 | 75 |
|
2352 | 76 |
handleCmd_lobby clID clients rooms ["JOIN_ROOM", roomName, roomPassword] |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
77 |
| noSuchRoom = [Warning "No such room"] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
78 |
| isRestrictedJoins jRoom = [Warning "Joining restricted"] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
79 |
| roomPassword /= password jRoom = [Warning "Wrong password"] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
80 |
| otherwise = |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
81 |
[RoomRemoveThisClient "", -- leave lobby |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
82 |
RoomAddThisClient rID] -- join room |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
83 |
++ answerNicks |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
84 |
++ answerReady |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
85 |
++ [AnswerThisRoom ["NOT_READY", nick client]] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
86 |
++ answerFullConfig |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
87 |
++ answerTeams |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
88 |
++ watchRound |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
89 |
where |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
90 |
noSuchRoom = isNothing mbRoom |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
91 |
mbRoom = find (\r -> roomName == name r && roomProto r == clientProto client) $ IntMap.elems rooms |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
92 |
jRoom = fromJust mbRoom |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
93 |
rID = roomUID jRoom |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
94 |
client = clients IntMap.! clID |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
95 |
roomClientsIDs = IntSet.elems $ playersIDs jRoom |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
96 |
answerNicks = |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
97 |
[AnswerThisClient $ "JOINED" : |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
98 |
map (\clID -> nick $ clients IntMap.! clID) roomClientsIDs | playersIn jRoom /= 0] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
99 |
answerReady = map |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
100 |
((\ c -> |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
101 |
AnswerThisClient |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
102 |
[if isReady c then "READY" else "NOT_READY", nick c]) |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
103 |
. (\ clID -> clients IntMap.! clID)) |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
104 |
roomClientsIDs |
1804 | 105 |
|
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
106 |
toAnswer (paramName, paramStrs) = AnswerThisClient $ "CFG" : paramName : paramStrs |
3425 | 107 |
|
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
108 |
answerFullConfig = map toAnswer (leftConfigPart ++ rightConfigPart) |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
109 |
(leftConfigPart, rightConfigPart) = partition (\(p, _) -> p /= "MAP") (Map.toList $ params jRoom) |
1813 | 110 |
|
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
111 |
watchRound = if not $ gameinprogress jRoom then |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
112 |
[] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
113 |
else |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
114 |
[AnswerThisClient ["RUN_GAME"], |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
115 |
AnswerThisClient $ "EM" : toEngineMsg "e$spectate 1" : Foldable.toList (roundMsgs jRoom)] |
1813 | 116 |
|
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
117 |
answerTeams = if gameinprogress jRoom then |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
118 |
answerAllTeams (clientProto client) (teamsAtStart jRoom) |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
119 |
else |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
120 |
answerAllTeams (clientProto client) (teams jRoom) |
1804 | 121 |
|
122 |
||
1905 | 123 |
handleCmd_lobby clID clients rooms ["JOIN_ROOM", roomName] = |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
124 |
handleCmd_lobby clID clients rooms ["JOIN_ROOM", roomName, ""] |
3425 | 125 |
|
2961
3e057dfa601f
Fix "FOLLOW" command handler and place it into proper file
unc0rr
parents:
2867
diff
changeset
|
126 |
|
3e057dfa601f
Fix "FOLLOW" command handler and place it into proper file
unc0rr
parents:
2867
diff
changeset
|
127 |
handleCmd_lobby clID clients rooms ["FOLLOW", asknick] = |
3e057dfa601f
Fix "FOLLOW" command handler and place it into proper file
unc0rr
parents:
2867
diff
changeset
|
128 |
if noSuchClient || roomID followClient == 0 then |
3e057dfa601f
Fix "FOLLOW" command handler and place it into proper file
unc0rr
parents:
2867
diff
changeset
|
129 |
[] |
3e057dfa601f
Fix "FOLLOW" command handler and place it into proper file
unc0rr
parents:
2867
diff
changeset
|
130 |
else |
3e057dfa601f
Fix "FOLLOW" command handler and place it into proper file
unc0rr
parents:
2867
diff
changeset
|
131 |
handleCmd_lobby clID clients rooms ["JOIN_ROOM", roomName] |
3e057dfa601f
Fix "FOLLOW" command handler and place it into proper file
unc0rr
parents:
2867
diff
changeset
|
132 |
where |
3e057dfa601f
Fix "FOLLOW" command handler and place it into proper file
unc0rr
parents:
2867
diff
changeset
|
133 |
maybeClient = Foldable.find (\cl -> asknick == nick cl) clients |
3e057dfa601f
Fix "FOLLOW" command handler and place it into proper file
unc0rr
parents:
2867
diff
changeset
|
134 |
noSuchClient = isNothing maybeClient |
3e057dfa601f
Fix "FOLLOW" command handler and place it into proper file
unc0rr
parents:
2867
diff
changeset
|
135 |
followClient = fromJust maybeClient |
3e057dfa601f
Fix "FOLLOW" command handler and place it into proper file
unc0rr
parents:
2867
diff
changeset
|
136 |
roomName = name $ rooms IntMap.! roomID followClient |
3e057dfa601f
Fix "FOLLOW" command handler and place it into proper file
unc0rr
parents:
2867
diff
changeset
|
137 |
|
1862 | 138 |
|
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
139 |
--------------------------- |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
140 |
-- Administrator's stuff -- |
1862 | 141 |
|
142 |
handleCmd_lobby clID clients rooms ["KICK", kickNick] = |
|
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
143 |
[KickClient kickID | isAdministrator client && (not noSuchClient) && kickID /= clID] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
144 |
where |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
145 |
client = clients IntMap.! clID |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
146 |
maybeClient = Foldable.find (\cl -> kickNick == nick cl) clients |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
147 |
noSuchClient = isNothing maybeClient |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
148 |
kickID = clientUID $ fromJust maybeClient |
1866 | 149 |
|
150 |
||
151 |
handleCmd_lobby clID clients rooms ["BAN", banNick] = |
|
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
152 |
if not $ isAdministrator client then |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
153 |
[] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
154 |
else |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
155 |
BanClient banNick : handleCmd_lobby clID clients rooms ["KICK", banNick] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
156 |
where |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
157 |
client = clients IntMap.! clID |
1862 | 158 |
|
1804 | 159 |
|
3283 | 160 |
|
161 |
handleCmd_lobby clID clients rooms ["SET_SERVER_VAR", "MOTD_NEW", newMessage] = |
|
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
162 |
[ModifyServerInfo (\si -> si{serverMessage = newMessage}) | isAdministrator client] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
163 |
where |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
164 |
client = clients IntMap.! clID |
1925 | 165 |
|
3283 | 166 |
handleCmd_lobby clID clients rooms ["SET_SERVER_VAR", "MOTD_OLD", newMessage] = |
3260
b44b88908758
Allow to set motd for old client versions (not used yet, as server needs some refactoring)
unc0rr
parents:
2961
diff
changeset
|
167 |
[ModifyServerInfo (\si -> si{serverMessageForOldVersions = newMessage}) | isAdministrator client] |
b44b88908758
Allow to set motd for old client versions (not used yet, as server needs some refactoring)
unc0rr
parents:
2961
diff
changeset
|
168 |
where |
b44b88908758
Allow to set motd for old client versions (not used yet, as server needs some refactoring)
unc0rr
parents:
2961
diff
changeset
|
169 |
client = clients IntMap.! clID |
b44b88908758
Allow to set motd for old client versions (not used yet, as server needs some refactoring)
unc0rr
parents:
2961
diff
changeset
|
170 |
|
3283 | 171 |
handleCmd_lobby clID clients rooms ["SET_SERVER_VAR", "LATEST_PROTO", protoNum] = |
3260
b44b88908758
Allow to set motd for old client versions (not used yet, as server needs some refactoring)
unc0rr
parents:
2961
diff
changeset
|
172 |
[ModifyServerInfo (\si -> si{latestReleaseVersion = fromJust readNum}) | isAdministrator client && isJust readNum] |
b44b88908758
Allow to set motd for old client versions (not used yet, as server needs some refactoring)
unc0rr
parents:
2961
diff
changeset
|
173 |
where |
b44b88908758
Allow to set motd for old client versions (not used yet, as server needs some refactoring)
unc0rr
parents:
2961
diff
changeset
|
174 |
client = clients IntMap.! clID |
b44b88908758
Allow to set motd for old client versions (not used yet, as server needs some refactoring)
unc0rr
parents:
2961
diff
changeset
|
175 |
readNum = maybeRead protoNum :: Maybe Word16 |
1925 | 176 |
|
3283 | 177 |
handleCmd_lobby clID clients rooms ["GET_SERVER_VAR"] = |
178 |
[SendServerVars | isAdministrator client] |
|
179 |
where |
|
180 |
client = clients IntMap.! clID |
|
181 |
||
182 |
||
2155
d897222d3339
Implement ability for server admin to clear accounts cache
unc0rr
parents:
2150
diff
changeset
|
183 |
handleCmd_lobby clID clients rooms ["CLEAR_ACCOUNTS_CACHE"] = |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
184 |
[ClearAccountsCache | isAdministrator client] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
185 |
where |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2408
diff
changeset
|
186 |
client = clients IntMap.! clID |
2155
d897222d3339
Implement ability for server admin to clear accounts cache
unc0rr
parents:
2150
diff
changeset
|
187 |
|
d897222d3339
Implement ability for server admin to clear accounts cache
unc0rr
parents:
2150
diff
changeset
|
188 |
|
1804 | 189 |
handleCmd_lobby clID _ _ _ = [ProtocolError "Incorrect command (state: in lobby)"] |
3435 | 190 |
-} |