author | alfadur |
Thu, 12 Nov 2020 00:24:58 +0300 | |
changeset 15759 | c929e25a7da2 |
parent 15699 | 27eb5abd5058 |
child 15788 | acf70c44065b |
permissions | -rw-r--r-- |
10460
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
1 |
{- |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
2 |
* Hedgewars, a free turn based strategy game |
11046 | 3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
10460
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
4 |
* |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
8 |
* |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
12 |
* GNU General Public License for more details. |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
13 |
* |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
17 |
\-} |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10259
diff
changeset
|
18 |
|
8403
fbc6e7602e05
- Allow server admins to use DELEGATE even when not room owner
unc0rr
parents:
8401
diff
changeset
|
19 |
{-# LANGUAGE CPP, OverloadedStrings, ScopedTypeVariables #-} |
7766 | 20 |
{-# OPTIONS_GHC -fno-warn-orphans #-} |
5184 | 21 |
module Actions where |
22 |
||
23 |
import Control.Concurrent |
|
24 |
import qualified Data.Set as Set |
|
8403
fbc6e7602e05
- Allow server admins to use DELEGATE even when not room owner
unc0rr
parents:
8401
diff
changeset
|
25 |
import qualified Data.Map as Map |
5184 | 26 |
import qualified Data.List as L |
27 |
import qualified Control.Exception as Exception |
|
28 |
import System.Log.Logger |
|
29 |
import Control.Monad |
|
30 |
import Data.Time |
|
31 |
import Data.Maybe |
|
32 |
import Control.Monad.Reader |
|
33 |
import Control.Monad.State.Strict |
|
34 |
import qualified Data.ByteString.Char8 as B |
|
35 |
import Control.DeepSeq |
|
36 |
import Data.Unique |
|
37 |
import Control.Arrow |
|
9448 | 38 |
import Control.Exception as E |
5209
f7a610e2ef5f
On restart command close server socket and spawn new server, keep running until last client quits
unc0rr
parents:
5184
diff
changeset
|
39 |
import System.Process |
f7a610e2ef5f
On restart command close server socket and spawn new server, keep running until last client quits
unc0rr
parents:
5184
diff
changeset
|
40 |
import Network.Socket |
9035
e84d42a4311c
'/rnd' command. Pass it a (possibly empty) list of items.
unc0rr
parents:
9032
diff
changeset
|
41 |
import System.Random |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
42 |
import qualified Data.Traversable as DT |
12864 | 43 |
import Text.Regex.TDFA |
11854 | 44 |
import qualified Text.Regex.TDFA as TDFA |
45 |
import qualified Text.Regex.TDFA.ByteString as TDFAB |
|
5184 | 46 |
----------------------------- |
7766 | 47 |
#if defined(OFFICIAL_SERVER) |
5996
2c72fe81dd37
Convert boolean variable + a bunch of fields which make sense only while game is going on into Maybe + structure
unc0rr
parents:
5426
diff
changeset
|
48 |
import OfficialServer.GameReplayStore |
14287
9f0d81213d65
Cut dependency on yaml for non-official server builds
unC0Rr
parents:
13730
diff
changeset
|
49 |
import qualified Data.Yaml as YAML |
7766 | 50 |
#endif |
5184 | 51 |
import CoreTypes |
52 |
import Utils |
|
53 |
import ClientIO |
|
54 |
import ServerState |
|
55 |
import Consts |
|
56 |
import ConfigFile |
|
6068 | 57 |
import EngineInteraction |
10092 | 58 |
import FloodDetection |
10212 | 59 |
import HWProtoCore |
10216 | 60 |
import Votes |
5184 | 61 |
|
62 |
othersChans :: StateT ServerState IO [ClientChan] |
|
63 |
othersChans = do |
|
64 |
cl <- client's id |
|
65 |
ri <- clientRoomA |
|
66 |
liftM (map sendChan . filter (/= cl)) $ roomClientsS ri |
|
67 |
||
68 |
processAction :: Action -> StateT ServerState IO () |
|
69 |
||
70 |
||
71 |
processAction (AnswerClients chans msg) = |
|
72 |
io $ mapM_ (`writeChan` (msg `deepseq` msg)) (chans `deepseq` chans) |
|
73 |
||
74 |
||
75 |
processAction SendServerMessage = do |
|
76 |
chan <- client's sendChan |
|
77 |
protonum <- client's clientProto |
|
78 |
si <- liftM serverInfo get |
|
79 |
let message = if protonum < latestReleaseVersion si then |
|
80 |
serverMessageForOldVersions si |
|
81 |
else |
|
82 |
serverMessage si |
|
83 |
processAction $ AnswerClients [chan] ["SERVER_MESSAGE", message] |
|
84 |
||
85 |
||
86 |
processAction SendServerVars = do |
|
87 |
chan <- client's sendChan |
|
88 |
si <- gets serverInfo |
|
89 |
io $ writeChan chan ("SERVER_VARS" : vars si) |
|
90 |
where |
|
91 |
vars si = [ |
|
92 |
"MOTD_NEW", serverMessage si, |
|
93 |
"MOTD_OLD", serverMessageForOldVersions si, |
|
94 |
"LATEST_PROTO", showB $ latestReleaseVersion si |
|
95 |
] |
|
96 |
||
97 |
||
98 |
processAction (ProtocolError msg) = do |
|
99 |
chan <- client's sendChan |
|
100 |
processAction $ AnswerClients [chan] ["ERROR", msg] |
|
101 |
||
102 |
||
103 |
processAction (Warning msg) = do |
|
104 |
chan <- client's sendChan |
|
105 |
processAction $ AnswerClients [chan] ["WARNING", msg] |
|
106 |
||
107 |
processAction (NoticeMessage n) = do |
|
108 |
chan <- client's sendChan |
|
109 |
processAction $ AnswerClients [chan] ["NOTICE", showB . fromEnum $ n] |
|
110 |
||
111 |
processAction (ByeClient msg) = do |
|
112 |
(Just ci) <- gets clientIndex |
|
113 |
ri <- clientRoomA |
|
114 |
||
115 |
chan <- client's sendChan |
|
116 |
clNick <- client's nick |
|
8372
3c193ec03e09
Logon procedure for checkers, introduce invisible clients
unc0rr
parents:
8371
diff
changeset
|
117 |
loggedIn <- client's isVisible |
5184 | 118 |
|
119 |
when (ri /= lobbyId) $ do |
|
13673
1aa5e884326a
Fix some string/translation inconsistencies in strings related to leaving
Wuzzy <Wuzzy2@mail.ru>
parents:
13657
diff
changeset
|
120 |
processAction $ (MoveToLobby msg) |
5184 | 121 |
return () |
122 |
||
8372
3c193ec03e09
Logon procedure for checkers, introduce invisible clients
unc0rr
parents:
8371
diff
changeset
|
123 |
clientsChans <- liftM (Prelude.map sendChan . Prelude.filter isVisible) $! allClientsS |
5184 | 124 |
io $ |
125 |
infoM "Clients" (show ci ++ " quits: " ++ B.unpack msg) |
|
126 |
||
127 |
when loggedIn $ processAction $ AnswerClients clientsChans ["LOBBY:LEFT", clNick, msg] |
|
128 |
||
8158 | 129 |
mapM_ processAction |
7465
c2dcf97ca664
Okay, this is workaround over ping timeouts problem on the server. Could make server crash if recieve thread wakes up after second ping timeout event.
unc0rr
parents:
7351
diff
changeset
|
130 |
[ |
c2dcf97ca664
Okay, this is workaround over ping timeouts problem on the server. Could make server crash if recieve thread wakes up after second ping timeout event.
unc0rr
parents:
7351
diff
changeset
|
131 |
AnswerClients [chan] ["BYE", msg] |
8372
3c193ec03e09
Logon procedure for checkers, introduce invisible clients
unc0rr
parents:
8371
diff
changeset
|
132 |
, ModifyClient (\c -> c{nick = "", isVisible = False}) -- this will effectively hide client from others while he isn't deleted from list |
7465
c2dcf97ca664
Okay, this is workaround over ping timeouts problem on the server. Could make server crash if recieve thread wakes up after second ping timeout event.
unc0rr
parents:
7351
diff
changeset
|
133 |
] |
c2dcf97ca664
Okay, this is workaround over ping timeouts problem on the server. Could make server crash if recieve thread wakes up after second ping timeout event.
unc0rr
parents:
7351
diff
changeset
|
134 |
|
5184 | 135 |
s <- get |
136 |
put $! s{removedClients = ci `Set.insert` removedClients s} |
|
137 |
||
138 |
processAction (DeleteClient ci) = do |
|
139 |
io $ debugM "Clients" $ "DeleteClient: " ++ show ci |
|
140 |
||
141 |
rnc <- gets roomsClients |
|
142 |
io $ removeClient rnc ci |
|
143 |
||
144 |
s <- get |
|
145 |
put $! s{removedClients = ci `Set.delete` removedClients s} |
|
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
146 |
|
5209
f7a610e2ef5f
On restart command close server socket and spawn new server, keep running until last client quits
unc0rr
parents:
5184
diff
changeset
|
147 |
sp <- gets (shutdownPending . serverInfo) |
f7a610e2ef5f
On restart command close server socket and spawn new server, keep running until last client quits
unc0rr
parents:
5184
diff
changeset
|
148 |
cls <- allClientsS |
f7a610e2ef5f
On restart command close server socket and spawn new server, keep running until last client quits
unc0rr
parents:
5184
diff
changeset
|
149 |
io $ when (sp && null cls) $ throwIO ShutdownException |
5184 | 150 |
|
151 |
processAction (ModifyClient f) = do |
|
152 |
(Just ci) <- gets clientIndex |
|
153 |
rnc <- gets roomsClients |
|
154 |
io $ modifyClient rnc f ci |
|
155 |
return () |
|
156 |
||
157 |
processAction (ModifyClient2 ci f) = do |
|
158 |
rnc <- gets roomsClients |
|
159 |
io $ modifyClient rnc f ci |
|
160 |
return () |
|
161 |
||
7757
c20e6c80e249
Don't accept ROUNDFINISHED message twice. Fixes game hangs when half of teams quit game.
unc0rr
parents:
7748
diff
changeset
|
162 |
processAction (ModifyRoomClients f) = do |
c20e6c80e249
Don't accept ROUNDFINISHED message twice. Fixes game hangs when half of teams quit game.
unc0rr
parents:
7748
diff
changeset
|
163 |
rnc <- gets roomsClients |
c20e6c80e249
Don't accept ROUNDFINISHED message twice. Fixes game hangs when half of teams quit game.
unc0rr
parents:
7748
diff
changeset
|
164 |
ri <- clientRoomA |
c20e6c80e249
Don't accept ROUNDFINISHED message twice. Fixes game hangs when half of teams quit game.
unc0rr
parents:
7748
diff
changeset
|
165 |
roomClIDs <- io $ roomClientsIndicesM rnc ri |
c20e6c80e249
Don't accept ROUNDFINISHED message twice. Fixes game hangs when half of teams quit game.
unc0rr
parents:
7748
diff
changeset
|
166 |
io $ mapM_ (modifyClient rnc f) roomClIDs |
c20e6c80e249
Don't accept ROUNDFINISHED message twice. Fixes game hangs when half of teams quit game.
unc0rr
parents:
7748
diff
changeset
|
167 |
|
5184 | 168 |
|
169 |
processAction (ModifyRoom f) = do |
|
170 |
rnc <- gets roomsClients |
|
171 |
ri <- clientRoomA |
|
172 |
io $ modifyRoom rnc f ri |
|
173 |
return () |
|
174 |
||
175 |
||
176 |
processAction (ModifyServerInfo f) = do |
|
177 |
modify (\s -> s{serverInfo = f $ serverInfo s}) |
|
178 |
si <- gets serverInfo |
|
179 |
io $ writeServerConfig si |
|
180 |
||
181 |
||
182 |
processAction (MoveToRoom ri) = do |
|
183 |
(Just ci) <- gets clientIndex |
|
184 |
rnc <- gets roomsClients |
|
185 |
||
186 |
io $ do |
|
9109
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
187 |
modifyClient rnc ( |
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
188 |
\cl -> cl{teamsInGame = 0 |
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
189 |
, isReady = False |
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
190 |
, isMaster = False |
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
191 |
, isInGame = False |
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
192 |
, isJoinedMidGame = False |
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
193 |
, clientClan = Nothing}) ci |
5184 | 194 |
modifyRoom rnc (\r -> r{playersIn = playersIn r + 1}) ri |
195 |
moveClientToRoom rnc ri ci |
|
196 |
||
197 |
chans <- liftM (map sendChan) $ roomClientsS ri |
|
198 |
clNick <- client's nick |
|
9193 | 199 |
allClientsChans <- liftM (Prelude.map sendChan . Prelude.filter isVisible) $! allClientsS |
5184 | 200 |
|
9193 | 201 |
mapM_ processAction [ |
202 |
AnswerClients chans ["JOINED", clNick] |
|
203 |
, AnswerClients allClientsChans ["CLIENT_FLAGS", "+i", clNick] |
|
10095 | 204 |
, RegisterEvent RoomJoin |
9193 | 205 |
] |
5184 | 206 |
|
207 |
||
208 |
processAction (MoveToLobby msg) = do |
|
209 |
(Just ci) <- gets clientIndex |
|
210 |
ri <- clientRoomA |
|
211 |
rnc <- gets roomsClients |
|
7766 | 212 |
playersNum <- io $ room'sM rnc playersIn ri |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
213 |
specialRoom <- io $ room'sM rnc isSpecial ri |
5184 | 214 |
master <- client's isMaster |
215 |
-- client <- client's id |
|
216 |
clNick <- client's nick |
|
217 |
chans <- othersChans |
|
218 |
||
219 |
if master then |
|
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
220 |
if (playersNum > 1) || specialRoom then |
8438
64ac58abd02a
Don't resend "team quit" message when client closes engine, then quits room:
unc0rr
parents:
8422
diff
changeset
|
221 |
mapM_ processAction [ChangeMaster Nothing, NoticeMessage AdminLeft, RemoveClientTeams, AnswerClients chans ["LEFT", clNick, msg]] |
5184 | 222 |
else |
223 |
processAction RemoveRoom |
|
224 |
else |
|
8438
64ac58abd02a
Don't resend "team quit" message when client closes engine, then quits room:
unc0rr
parents:
8422
diff
changeset
|
225 |
mapM_ processAction [RemoveClientTeams, AnswerClients chans ["LEFT", clNick, msg]] |
5184 | 226 |
|
9193 | 227 |
allClientsChans <- liftM (Prelude.map sendChan . Prelude.filter isVisible) $! allClientsS |
228 |
processAction $ AnswerClients allClientsChans ["CLIENT_FLAGS", "-i", clNick] |
|
229 |
||
5184 | 230 |
-- when not removing room |
7351
34efdd1f230f
- Check ready status only after deleting player's teams (should fix the bug when you're unable to start game)
unc0rr
parents:
7321
diff
changeset
|
231 |
ready <- client's isReady |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
232 |
when (not master || playersNum > 1 || specialRoom) . io $ do |
5184 | 233 |
modifyRoom rnc (\r -> r{ |
234 |
playersIn = playersIn r - 1, |
|
235 |
readyPlayers = if ready then readyPlayers r - 1 else readyPlayers r |
|
236 |
}) ri |
|
237 |
moveClientToLobby rnc ci |
|
238 |
||
7710
fd5bcbd698a5
- Keep track of room name so correct name is displayed when you become room admin
unc0rr
parents:
7682
diff
changeset
|
239 |
|
8247 | 240 |
processAction (ChangeMaster delegateId)= do |
5184 | 241 |
(Just ci) <- gets clientIndex |
7710
fd5bcbd698a5
- Keep track of room name so correct name is displayed when you become room admin
unc0rr
parents:
7682
diff
changeset
|
242 |
proto <- client's clientProto |
5184 | 243 |
ri <- clientRoomA |
244 |
rnc <- gets roomsClients |
|
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
245 |
specialRoom <- io $ room'sM rnc isSpecial ri |
10056
cb9e07753802
Don't delegate special room to another player when owner quits
unc0rr
parents:
10017
diff
changeset
|
246 |
newMasterId <- if specialRoom then |
10058 | 247 |
return delegateId |
10056
cb9e07753802
Don't delegate special room to another player when owner quits
unc0rr
parents:
10017
diff
changeset
|
248 |
else |
cb9e07753802
Don't delegate special room to another player when owner quits
unc0rr
parents:
10017
diff
changeset
|
249 |
liftM (\ids -> fromMaybe (listToMaybe . reverse . filter (/= ci) $ ids) $ liftM Just delegateId) . io $ roomClientsIndicesM rnc ri |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
250 |
newMaster <- io $ client'sM rnc id `DT.mapM` newMasterId |
9062
a65492ca1587
Fix room admin rights delegation by server admin when he isn't room admin
unc0rr
parents:
9060
diff
changeset
|
251 |
oldMasterId <- io $ room'sM rnc masterID ri |
6733 | 252 |
oldRoomName <- io $ room'sM rnc name ri |
8245 | 253 |
kicked <- client's isKickedFromServer |
7668
4cb423f42105
Show who is the room admin on join (no tested, also I don't like how it is done via server warnings, but it seems there's no other solution compatible with .17)
unc0rr
parents:
7664
diff
changeset
|
254 |
thisRoomChans <- liftM (map sendChan) $ roomClientsS ri |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
255 |
let newRoomName = if ((proto < 42) || kicked) && (not specialRoom) then maybeNick newMaster else oldRoomName |
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
256 |
|
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
257 |
when (isJust oldMasterId) $ do |
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
258 |
oldMasterNick <- io $ client'sM rnc nick (fromJust oldMasterId) |
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
259 |
mapM_ processAction [ |
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
260 |
ModifyClient2 (fromJust oldMasterId) (\c -> c{isMaster = False}) |
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
261 |
, AnswerClients thisRoomChans ["CLIENT_FLAGS", "-h", oldMasterNick] |
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
262 |
] |
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
263 |
|
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
264 |
when (isJust newMasterId) $ |
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
265 |
mapM_ processAction [ |
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
266 |
ModifyClient2 (fromJust newMasterId) (\c -> c{isMaster = True}) |
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
267 |
, AnswerClients [sendChan $ fromJust newMaster] ["ROOM_CONTROL_ACCESS", "1"] |
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
268 |
, AnswerClients thisRoomChans ["CLIENT_FLAGS", "+h", nick $ fromJust newMaster] |
13703
2df519242d41
Add a couple of more useful server messages
Wuzzy <Wuzzy2@mail.ru>
parents:
13696
diff
changeset
|
269 |
-- TODO: Send message to other clients, too (requires proper localization, however) |
2df519242d41
Add a couple of more useful server messages
Wuzzy <Wuzzy2@mail.ru>
parents:
13696
diff
changeset
|
270 |
, AnswerClients [sendChan $ fromJust newMaster] ["CHAT", nickServer, loc "You're the new room master!"] |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
271 |
] |
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
272 |
|
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
273 |
processAction $ |
7775 | 274 |
ModifyRoom (\r -> r{masterID = newMasterId |
275 |
, name = newRoomName |
|
276 |
, isRestrictedJoins = False |
|
277 |
, isRestrictedTeams = False |
|
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
278 |
, isRegisteredOnly = isSpecial r} |
8983 | 279 |
) |
5184 | 280 |
|
7766 | 281 |
newRoom' <- io $ room'sM rnc id ri |
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
|
282 |
chans <- liftM (map sendChan) $! sameProtoClientsS proto |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
283 |
processAction $ AnswerClients chans ("ROOM" : "UPD" : oldRoomName : roomInfo proto (maybeNick newMaster) newRoom') |
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
|
284 |
|
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
285 |
|
5184 | 286 |
processAction (AddRoom roomName roomPassword) = do |
287 |
Just clId <- gets clientIndex |
|
288 |
rnc <- gets roomsClients |
|
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
|
289 |
proto <- client's clientProto |
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
|
290 |
n <- client's nick |
5184 | 291 |
|
292 |
let rm = newRoom{ |
|
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
293 |
masterID = Just clId, |
5184 | 294 |
name = roomName, |
295 |
password = roomPassword, |
|
296 |
roomProto = proto |
|
297 |
} |
|
298 |
||
299 |
rId <- io $ addRoom rnc rm |
|
300 |
||
301 |
processAction $ MoveToRoom rId |
|
302 |
||
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
|
303 |
chans <- liftM (map sendChan) $! sameProtoClientsS proto |
5184 | 304 |
|
305 |
mapM_ processAction [ |
|
9702 | 306 |
AnswerClients chans ("ROOM" : "ADD" : roomInfo proto n rm{playersIn = 1}) |
5184 | 307 |
] |
308 |
||
309 |
||
310 |
processAction RemoveRoom = do |
|
311 |
Just clId <- gets clientIndex |
|
312 |
rnc <- gets roomsClients |
|
313 |
ri <- io $ clientRoomM rnc clId |
|
314 |
roomName <- io $ room'sM rnc name ri |
|
315 |
others <- othersChans |
|
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
|
316 |
proto <- client's clientProto |
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
|
317 |
chans <- liftM (map sendChan) $! sameProtoClientsS proto |
5184 | 318 |
|
319 |
mapM_ processAction [ |
|
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
|
320 |
AnswerClients chans ["ROOM", "DEL", roomName], |
5184 | 321 |
AnswerClients others ["ROOMABANDONED", roomName] |
322 |
] |
|
323 |
||
324 |
io $ removeRoom rnc ri |
|
325 |
||
326 |
||
7921
6b074de32bea
Send ROOM UPD message when team is added/deleted from room, and when game starts or finishes
unc0rr
parents:
7898
diff
changeset
|
327 |
processAction SendUpdateOnThisRoom = do |
6b074de32bea
Send ROOM UPD message when team is added/deleted from room, and when game starts or finishes
unc0rr
parents:
7898
diff
changeset
|
328 |
Just clId <- gets clientIndex |
6b074de32bea
Send ROOM UPD message when team is added/deleted from room, and when game starts or finishes
unc0rr
parents:
7898
diff
changeset
|
329 |
proto <- client's clientProto |
6b074de32bea
Send ROOM UPD message when team is added/deleted from room, and when game starts or finishes
unc0rr
parents:
7898
diff
changeset
|
330 |
rnc <- gets roomsClients |
6b074de32bea
Send ROOM UPD message when team is added/deleted from room, and when game starts or finishes
unc0rr
parents:
7898
diff
changeset
|
331 |
ri <- io $ clientRoomM rnc clId |
6b074de32bea
Send ROOM UPD message when team is added/deleted from room, and when game starts or finishes
unc0rr
parents:
7898
diff
changeset
|
332 |
rm <- io $ room'sM rnc id ri |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
333 |
masterCl <- io $ client'sM rnc id `DT.mapM` (masterID rm) |
7921
6b074de32bea
Send ROOM UPD message when team is added/deleted from room, and when game starts or finishes
unc0rr
parents:
7898
diff
changeset
|
334 |
chans <- liftM (map sendChan) $! sameProtoClientsS proto |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9702
diff
changeset
|
335 |
processAction $ AnswerClients chans ("ROOM" : "UPD" : name rm : roomInfo proto (maybeNick masterCl) rm) |
7921
6b074de32bea
Send ROOM UPD message when team is added/deleted from room, and when game starts or finishes
unc0rr
parents:
7898
diff
changeset
|
336 |
|
6b074de32bea
Send ROOM UPD message when team is added/deleted from room, and when game starts or finishes
unc0rr
parents:
7898
diff
changeset
|
337 |
|
6758
26bf919aeb57
Oh, should also check for game finish when player quits without ROUNDFINISHED message: small refactoring, not tested at all
unc0rr
parents:
6756
diff
changeset
|
338 |
processAction UnreadyRoomClients = do |
5184 | 339 |
ri <- clientRoomA |
340 |
roomPlayers <- roomClientsS ri |
|
341 |
pr <- client's clientProto |
|
7757
c20e6c80e249
Don't accept ROUNDFINISHED message twice. Fixes game hangs when half of teams quit game.
unc0rr
parents:
7748
diff
changeset
|
342 |
mapM_ processAction [ |
7775 | 343 |
AnswerClients (map sendChan roomPlayers) $ notReadyMessage pr . map nick . filter (not . isMaster) $ roomPlayers |
9109
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
344 |
, ModifyRoomClients (\cl -> cl{isReady = isMaster cl, isJoinedMidGame = False}) |
7775 | 345 |
, ModifyRoom (\r -> r{readyPlayers = 1}) |
7757
c20e6c80e249
Don't accept ROUNDFINISHED message twice. Fixes game hangs when half of teams quit game.
unc0rr
parents:
7748
diff
changeset
|
346 |
] |
5184 | 347 |
where |
348 |
notReadyMessage p nicks = if p < 38 then "NOT_READY" : nicks else "CLIENT_FLAGS" : "-r" : nicks |
|
349 |
||
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
350 |
|
6758
26bf919aeb57
Oh, should also check for game finish when player quits without ROUNDFINISHED message: small refactoring, not tested at all
unc0rr
parents:
6756
diff
changeset
|
351 |
processAction FinishGame = do |
26bf919aeb57
Oh, should also check for game finish when player quits without ROUNDFINISHED message: small refactoring, not tested at all
unc0rr
parents:
6756
diff
changeset
|
352 |
rnc <- gets roomsClients |
26bf919aeb57
Oh, should also check for game finish when player quits without ROUNDFINISHED message: small refactoring, not tested at all
unc0rr
parents:
6756
diff
changeset
|
353 |
ri <- clientRoomA |
26bf919aeb57
Oh, should also check for game finish when player quits without ROUNDFINISHED message: small refactoring, not tested at all
unc0rr
parents:
6756
diff
changeset
|
354 |
thisRoomChans <- liftM (map sendChan) $ roomClientsS ri |
9109
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
355 |
joinedMidGame <- liftM (filter isJoinedMidGame) $ roomClientsS ri |
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
356 |
answerRemovedTeams <- io $ |
10017 | 357 |
room'sM rnc (\r -> let gi = fromJust $ gameInfo r in |
358 |
concatMap (\c -> |
|
9109
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
359 |
(answerFullConfigParams c (mapParams r) (params r)) |
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
360 |
++ |
10017 | 361 |
(map (\t -> AnswerClients [sendChan c] ["REMOVE_TEAM", t]) $ leftTeams gi) |
9109
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
362 |
) joinedMidGame |
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
363 |
) ri |
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
364 |
|
10814
810ac1d21fd0
This should help with second rejoin bug. (reverting previous workaround over frontend bug and making a new one)
unc0rr
parents:
10786
diff
changeset
|
365 |
rteams <- io $ room'sM rnc (L.nub . rejoinedTeams . fromJust . gameInfo) ri |
810ac1d21fd0
This should help with second rejoin bug. (reverting previous workaround over frontend bug and making a new one)
unc0rr
parents:
10786
diff
changeset
|
366 |
mapM_ (processAction . RemoveTeam) rteams |
810ac1d21fd0
This should help with second rejoin bug. (reverting previous workaround over frontend bug and making a new one)
unc0rr
parents:
10786
diff
changeset
|
367 |
|
9109
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
368 |
mapM_ processAction $ ( |
7124 | 369 |
SaveReplay |
7126
8daa5c8e84c0
Bring leftTeams back (with a fix) as it is apparently needed for spectators.
unc0rr
parents:
7124
diff
changeset
|
370 |
: ModifyRoom |
6758
26bf919aeb57
Oh, should also check for game finish when player quits without ROUNDFINISHED message: small refactoring, not tested at all
unc0rr
parents:
6756
diff
changeset
|
371 |
(\r -> r{ |
26bf919aeb57
Oh, should also check for game finish when player quits without ROUNDFINISHED message: small refactoring, not tested at all
unc0rr
parents:
6756
diff
changeset
|
372 |
gameInfo = Nothing, |
26bf919aeb57
Oh, should also check for game finish when player quits without ROUNDFINISHED message: small refactoring, not tested at all
unc0rr
parents:
6756
diff
changeset
|
373 |
readyPlayers = 0 |
26bf919aeb57
Oh, should also check for game finish when player quits without ROUNDFINISHED message: small refactoring, not tested at all
unc0rr
parents:
6756
diff
changeset
|
374 |
} |
26bf919aeb57
Oh, should also check for game finish when player quits without ROUNDFINISHED message: small refactoring, not tested at all
unc0rr
parents:
6756
diff
changeset
|
375 |
) |
7921
6b074de32bea
Send ROOM UPD message when team is added/deleted from room, and when game starts or finishes
unc0rr
parents:
7898
diff
changeset
|
376 |
: SendUpdateOnThisRoom |
8241
b15f165c080c
Send "ROUND_FINISHED" to room clients when server thinks so
unc0rr
parents:
8239
diff
changeset
|
377 |
: AnswerClients thisRoomChans ["ROUND_FINISHED"] |
7126
8daa5c8e84c0
Bring leftTeams back (with a fix) as it is apparently needed for spectators.
unc0rr
parents:
7124
diff
changeset
|
378 |
: answerRemovedTeams |
9109
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
379 |
) |
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9062
diff
changeset
|
380 |
++ [UnreadyRoomClients] |
5184 | 381 |
|
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
382 |
|
6753
e95b1f62d0de
Don't remove client's teams from teams list on "ROUNDFINISHED 0", just send team removal message to others.
unc0rr
parents:
6733
diff
changeset
|
383 |
processAction (SendTeamRemovalMessage teamName) = do |
e95b1f62d0de
Don't remove client's teams from teams list on "ROUNDFINISHED 0", just send team removal message to others.
unc0rr
parents:
6733
diff
changeset
|
384 |
chans <- othersChans |
e95b1f62d0de
Don't remove client's teams from teams list on "ROUNDFINISHED 0", just send team removal message to others.
unc0rr
parents:
6733
diff
changeset
|
385 |
mapM_ processAction [ |
e95b1f62d0de
Don't remove client's teams from teams list on "ROUNDFINISHED 0", just send team removal message to others.
unc0rr
parents:
6733
diff
changeset
|
386 |
AnswerClients chans ["EM", rmTeamMsg], |
e95b1f62d0de
Don't remove client's teams from teams list on "ROUNDFINISHED 0", just send team removal message to others.
unc0rr
parents:
6733
diff
changeset
|
387 |
ModifyRoom (\r -> r{ |
e95b1f62d0de
Don't remove client's teams from teams list on "ROUNDFINISHED 0", just send team removal message to others.
unc0rr
parents:
6733
diff
changeset
|
388 |
gameInfo = liftM (\g -> g{ |
7124 | 389 |
teamsInGameNumber = teamsInGameNumber g - 1 |
10944
c4b3440eeac6
- Fix order of messages, also don't duplicate last timestamped message
unc0rr
parents:
10814
diff
changeset
|
390 |
, lastFilteredTimedMsg = Nothing |
c4b3440eeac6
- Fix order of messages, also don't duplicate last timestamped message
unc0rr
parents:
10814
diff
changeset
|
391 |
, roundMsgs = (if isJust $ lastFilteredTimedMsg g then ((:) rmTeamMsg . (:) (fromJust $ lastFilteredTimedMsg g)) else ((:) rmTeamMsg)) |
c4b3440eeac6
- Fix order of messages, also don't duplicate last timestamped message
unc0rr
parents:
10814
diff
changeset
|
392 |
$ roundMsgs g |
6753
e95b1f62d0de
Don't remove client's teams from teams list on "ROUNDFINISHED 0", just send team removal message to others.
unc0rr
parents:
6733
diff
changeset
|
393 |
}) $ gameInfo r |
e95b1f62d0de
Don't remove client's teams from teams list on "ROUNDFINISHED 0", just send team removal message to others.
unc0rr
parents:
6733
diff
changeset
|
394 |
}) |
e95b1f62d0de
Don't remove client's teams from teams list on "ROUNDFINISHED 0", just send team removal message to others.
unc0rr
parents:
6733
diff
changeset
|
395 |
] |
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
396 |
|
6758
26bf919aeb57
Oh, should also check for game finish when player quits without ROUNDFINISHED message: small refactoring, not tested at all
unc0rr
parents:
6756
diff
changeset
|
397 |
rnc <- gets roomsClients |
26bf919aeb57
Oh, should also check for game finish when player quits without ROUNDFINISHED message: small refactoring, not tested at all
unc0rr
parents:
6756
diff
changeset
|
398 |
ri <- clientRoomA |
26bf919aeb57
Oh, should also check for game finish when player quits without ROUNDFINISHED message: small refactoring, not tested at all
unc0rr
parents:
6756
diff
changeset
|
399 |
gi <- io $ room'sM rnc gameInfo ri |
8422 | 400 |
when (0 == teamsInGameNumber (fromJust gi)) $ |
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
401 |
processAction FinishGame |
6753
e95b1f62d0de
Don't remove client's teams from teams list on "ROUNDFINISHED 0", just send team removal message to others.
unc0rr
parents:
6733
diff
changeset
|
402 |
where |
e95b1f62d0de
Don't remove client's teams from teams list on "ROUNDFINISHED 0", just send team removal message to others.
unc0rr
parents:
6733
diff
changeset
|
403 |
rmTeamMsg = toEngineMsg $ 'F' `B.cons` teamName |
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
404 |
|
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
405 |
|
5184 | 406 |
processAction (RemoveTeam teamName) = do |
8438
64ac58abd02a
Don't resend "team quit" message when client closes engine, then quits room:
unc0rr
parents:
8422
diff
changeset
|
407 |
(Just ci) <- gets clientIndex |
5184 | 408 |
rnc <- gets roomsClients |
409 |
ri <- clientRoomA |
|
8438
64ac58abd02a
Don't resend "team quit" message when client closes engine, then quits room:
unc0rr
parents:
8422
diff
changeset
|
410 |
inGame <- io $ do |
64ac58abd02a
Don't resend "team quit" message when client closes engine, then quits room:
unc0rr
parents:
8422
diff
changeset
|
411 |
r <- room'sM rnc (isJust . gameInfo) ri |
64ac58abd02a
Don't resend "team quit" message when client closes engine, then quits room:
unc0rr
parents:
8422
diff
changeset
|
412 |
c <- client'sM rnc isInGame ci |
64ac58abd02a
Don't resend "team quit" message when client closes engine, then quits room:
unc0rr
parents:
8422
diff
changeset
|
413 |
return $ r && c |
5184 | 414 |
chans <- othersChans |
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
415 |
mapM_ processAction $ |
7126
8daa5c8e84c0
Bring leftTeams back (with a fix) as it is apparently needed for spectators.
unc0rr
parents:
7124
diff
changeset
|
416 |
ModifyRoom (\r -> r{ |
8daa5c8e84c0
Bring leftTeams back (with a fix) as it is apparently needed for spectators.
unc0rr
parents:
7124
diff
changeset
|
417 |
teams = Prelude.filter (\t -> teamName /= teamname t) $ teams r |
8daa5c8e84c0
Bring leftTeams back (with a fix) as it is apparently needed for spectators.
unc0rr
parents:
7124
diff
changeset
|
418 |
, gameInfo = liftM (\g -> g{leftTeams = teamName : leftTeams g}) $ gameInfo r |
8daa5c8e84c0
Bring leftTeams back (with a fix) as it is apparently needed for spectators.
unc0rr
parents:
7124
diff
changeset
|
419 |
}) |
7947 | 420 |
: SendUpdateOnThisRoom |
7124 | 421 |
: AnswerClients chans ["REMOVE_TEAM", teamName] |
422 |
: [SendTeamRemovalMessage teamName | inGame] |
|
5184 | 423 |
|
424 |
||
8438
64ac58abd02a
Don't resend "team quit" message when client closes engine, then quits room:
unc0rr
parents:
8422
diff
changeset
|
425 |
processAction RemoveClientTeams = do |
64ac58abd02a
Don't resend "team quit" message when client closes engine, then quits room:
unc0rr
parents:
8422
diff
changeset
|
426 |
(Just ci) <- gets clientIndex |
5184 | 427 |
rnc <- gets roomsClients |
10732
7c4f9e5e447c
Get rid of teamownerId since rejoin feature makes it virtually useless, as you cannot rely on it anymore. Should fix recently experienced server crashes.
unc0rr
parents:
10460
diff
changeset
|
428 |
n <- client's nick |
5184 | 429 |
|
430 |
removeTeamActions <- io $ do |
|
8438
64ac58abd02a
Don't resend "team quit" message when client closes engine, then quits room:
unc0rr
parents:
8422
diff
changeset
|
431 |
rId <- clientRoomM rnc ci |
5184 | 432 |
roomTeams <- room'sM rnc teams rId |
10732
7c4f9e5e447c
Get rid of teamownerId since rejoin feature makes it virtually useless, as you cannot rely on it anymore. Should fix recently experienced server crashes.
unc0rr
parents:
10460
diff
changeset
|
433 |
return . Prelude.map (RemoveTeam . teamname) . Prelude.filter (\t -> teamowner t == n) $ roomTeams |
5184 | 434 |
|
435 |
mapM_ processAction removeTeamActions |
|
436 |
||
437 |
||
10786
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
438 |
processAction SetRandomSeed = do |
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
439 |
ri <- clientRoomA |
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
440 |
thisRoomChans <- liftM (map sendChan) $ roomClientsS ri |
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
441 |
seed <- liftM showB $ io $ (randomRIO (0, 10^9) :: IO Int) |
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
442 |
mapM_ processAction [ |
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
443 |
ModifyRoom (\r -> r{mapParams = Map.insert "SEED" seed $ mapParams r}) |
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
444 |
, AnswerClients thisRoomChans ["CFG", "SEED", seed] |
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
445 |
] |
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
446 |
|
5184 | 447 |
|
448 |
processAction CheckRegistered = do |
|
449 |
(Just ci) <- gets clientIndex |
|
450 |
n <- client's nick |
|
451 |
h <- client's host |
|
452 |
p <- client's clientProto |
|
8371 | 453 |
checker <- client's isChecker |
5184 | 454 |
uid <- client's clUID |
8371 | 455 |
-- allow multiple checker logins |
456 |
haveSameNick <- liftM (not . null . tail . filter (\c -> (not $ isChecker c) && caseInsensitiveCompare (nick c) n)) allClientsS |
|
8476 | 457 |
if (not checker) && haveSameNick then |
5184 | 458 |
if p < 38 then |
8401
87410ae372f6
Server messages localization using Qt's l10n subsystem:
unc0rr
parents:
8396
diff
changeset
|
459 |
processAction $ ByeClient $ loc "Nickname is already in use" |
5184 | 460 |
else |
9032
2345f5f96a29
Clear nickname in case of collision so client could try again. Should help with issue 550 if not fix it.
unc0rr
parents:
8983
diff
changeset
|
461 |
mapM_ processAction [NoticeMessage NickAlreadyInUse, ModifyClient $ \c -> c{nick = B.empty}] |
5184 | 462 |
else |
463 |
do |
|
464 |
db <- gets (dbQueries . serverInfo) |
|
465 |
io $ writeChan db $ CheckAccount ci (hashUnique uid) n h |
|
466 |
return () |
|
467 |
||
468 |
processAction ClearAccountsCache = do |
|
469 |
dbq <- gets (dbQueries . serverInfo) |
|
470 |
io $ writeChan dbq ClearCache |
|
471 |
return () |
|
472 |
||
473 |
||
8189 | 474 |
processAction (ProcessAccountInfo info) = do |
11465
0ae2e4c13bd1
Allow toggling registration requirement on live server
unc0rr
parents:
11463
diff
changeset
|
475 |
si <- gets serverInfo |
5184 | 476 |
case info of |
9435 | 477 |
HasAccount passwd isAdmin isContr -> do |
8189 | 478 |
b <- isBanned |
8372
3c193ec03e09
Logon procedure for checkers, introduce invisible clients
unc0rr
parents:
8371
diff
changeset
|
479 |
c <- client's isChecker |
9435 | 480 |
when (not b) $ (if c then checkerLogin else playerLogin) passwd isAdmin isContr |
11465
0ae2e4c13bd1
Allow toggling registration requirement on live server
unc0rr
parents:
11463
diff
changeset
|
481 |
Guest | isRegisteredUsersOnly si -> do |
13728
3106d630d6b5
Make guest rejection error translatable
Wuzzy <Wuzzy2@mail.ru>
parents:
13703
diff
changeset
|
482 |
processAction $ ByeClient $ loc "This server only allows registered users to join." |
11465
0ae2e4c13bd1
Allow toggling registration requirement on live server
unc0rr
parents:
11463
diff
changeset
|
483 |
| otherwise -> do |
8189 | 484 |
b <- isBanned |
8523 | 485 |
c <- client's isChecker |
8189 | 486 |
when (not b) $ |
8523 | 487 |
if c then |
9435 | 488 |
checkerLogin "" False False |
8523 | 489 |
else |
490 |
processAction JoinLobby |
|
9786 | 491 |
Admin -> |
5184 | 492 |
mapM_ processAction [ModifyClient (\cl -> cl{isAdministrator = True}), JoinLobby] |
9446 | 493 |
ReplayName fn -> processAction $ ShowReplay fn |
8189 | 494 |
where |
495 |
isBanned = do |
|
8239 | 496 |
processAction $ CheckBanned False |
8189 | 497 |
liftM B.null $ client's nick |
9435 | 498 |
checkerLogin _ False _ = processAction $ ByeClient $ loc "No checker rights" |
499 |
checkerLogin p True _ = do |
|
8372
3c193ec03e09
Logon procedure for checkers, introduce invisible clients
unc0rr
parents:
8371
diff
changeset
|
500 |
wp <- client's webPassword |
10014 | 501 |
chan <- client's sendChan |
502 |
mapM_ processAction $ |
|
10017 | 503 |
if wp == p then |
10014 | 504 |
[ModifyClient $ \c -> c{logonPassed = True} |
505 |
, AnswerClients [chan] ["LOGONPASSED"] |
|
506 |
] |
|
10017 | 507 |
else |
10014 | 508 |
[ByeClient $ loc "Authentication failed"] |
9435 | 509 |
playerLogin p a contr = do |
10076 | 510 |
cl <- client's id |
9435 | 511 |
mapM_ processAction [ |
10076 | 512 |
AnswerClients [sendChan cl] $ ("ASKPASSWORD") : if clientProto cl < 48 then [] else [serverSalt cl] |
9435 | 513 |
, ModifyClient (\c -> c{webPassword = p, isAdministrator = a, isContributor = contr}) |
514 |
] |
|
5184 | 515 |
|
516 |
processAction JoinLobby = do |
|
517 |
chan <- client's sendChan |
|
9528 | 518 |
rnc <- gets roomsClients |
5184 | 519 |
clientNick <- client's nick |
11463 | 520 |
clProto <- client's clientProto |
12761
0167e337553b
Use maybeNick from Utils, fixes empty nickname inserted in ROOMS protocol command parameters. Not tested, but builds, and it's Haskell...
unc0rr
parents:
12114
diff
changeset
|
521 |
isAuthenticated <- client's isRegistered |
7498
86984f6fa1b9
Introduce 'a' and 'u' client flags to mark admins and authenticated users
unc0rr
parents:
7465
diff
changeset
|
522 |
isAdmin <- client's isAdministrator |
9435 | 523 |
isContr <- client's isContributor |
8372
3c193ec03e09
Logon procedure for checkers, introduce invisible clients
unc0rr
parents:
8371
diff
changeset
|
524 |
loggedInClients <- liftM (Prelude.filter isVisible) $! allClientsS |
7498
86984f6fa1b9
Introduce 'a' and 'u' client flags to mark admins and authenticated users
unc0rr
parents:
7465
diff
changeset
|
525 |
let (lobbyNicks, clientsChans) = unzip . L.map (nick &&& sendChan) $ loggedInClients |
12114
cdadc1d487f1
Only registered players regain their teams on rejoin
unc0rr
parents:
11854
diff
changeset
|
526 |
let authenticatedNicks = L.map nick . L.filter isRegistered $ loggedInClients |
7498
86984f6fa1b9
Introduce 'a' and 'u' client flags to mark admins and authenticated users
unc0rr
parents:
7465
diff
changeset
|
527 |
let adminsNicks = L.map nick . L.filter isAdministrator $ loggedInClients |
9435 | 528 |
let contrNicks = L.map nick . L.filter isContributor $ loggedInClients |
9528 | 529 |
inRoomNicks <- io $ |
530 |
allClientsM rnc |
|
531 |
>>= filterM (liftM ((/=) lobbyId) . clientRoomM rnc) |
|
532 |
>>= mapM (client'sM rnc nick) |
|
9435 | 533 |
let clFlags = B.concat . L.concat $ [["u" | isAuthenticated], ["a" | isAdmin], ["c" | isContr]] |
11463 | 534 |
|
535 |
roomsInfoList <- io $ do |
|
536 |
rooms <- roomsM rnc |
|
12761
0167e337553b
Use maybeNick from Utils, fixes empty nickname inserted in ROOMS protocol command parameters. Not tested, but builds, and it's Haskell...
unc0rr
parents:
12114
diff
changeset
|
537 |
mapM (\r -> (mapM (client'sM rnc id) $ masterID r) |
0167e337553b
Use maybeNick from Utils, fixes empty nickname inserted in ROOMS protocol command parameters. Not tested, but builds, and it's Haskell...
unc0rr
parents:
12114
diff
changeset
|
538 |
>>= \cn -> return $ roomInfo clProto (maybeNick cn) r) |
11463 | 539 |
$ filter (\r -> (roomProto r == clProto)) rooms |
540 |
||
7498
86984f6fa1b9
Introduce 'a' and 'u' client flags to mark admins and authenticated users
unc0rr
parents:
7465
diff
changeset
|
541 |
mapM_ processAction . concat $ [ |
86984f6fa1b9
Introduce 'a' and 'u' client flags to mark admins and authenticated users
unc0rr
parents:
7465
diff
changeset
|
542 |
[AnswerClients clientsChans ["LOBBY:JOINED", clientNick]] |
86984f6fa1b9
Introduce 'a' and 'u' client flags to mark admins and authenticated users
unc0rr
parents:
7465
diff
changeset
|
543 |
, [AnswerClients [chan] ("LOBBY:JOINED" : clientNick : lobbyNicks)] |
86984f6fa1b9
Introduce 'a' and 'u' client flags to mark admins and authenticated users
unc0rr
parents:
7465
diff
changeset
|
544 |
, [AnswerClients [chan] ("CLIENT_FLAGS" : "+u" : authenticatedNicks) | not $ null authenticatedNicks] |
86984f6fa1b9
Introduce 'a' and 'u' client flags to mark admins and authenticated users
unc0rr
parents:
7465
diff
changeset
|
545 |
, [AnswerClients [chan] ("CLIENT_FLAGS" : "+a" : adminsNicks) | not $ null adminsNicks] |
9435 | 546 |
, [AnswerClients [chan] ("CLIENT_FLAGS" : "+c" : contrNicks) | not $ null contrNicks] |
9528 | 547 |
, [AnswerClients [chan] ("CLIENT_FLAGS" : "+i" : inRoomNicks) | not $ null inRoomNicks] |
7498
86984f6fa1b9
Introduce 'a' and 'u' client flags to mark admins and authenticated users
unc0rr
parents:
7465
diff
changeset
|
548 |
, [AnswerClients (chan : clientsChans) ["CLIENT_FLAGS", B.concat["+" , clFlags], clientNick] | not $ B.null clFlags] |
8372
3c193ec03e09
Logon procedure for checkers, introduce invisible clients
unc0rr
parents:
8371
diff
changeset
|
549 |
, [ModifyClient (\cl -> cl{logonPassed = True, isVisible = True})] |
7498
86984f6fa1b9
Introduce 'a' and 'u' client flags to mark admins and authenticated users
unc0rr
parents:
7465
diff
changeset
|
550 |
, [SendServerMessage] |
11463 | 551 |
, [AnswerClients [chan] ("ROOMS" : concat roomsInfoList)] |
7498
86984f6fa1b9
Introduce 'a' and 'u' client flags to mark admins and authenticated users
unc0rr
parents:
7465
diff
changeset
|
552 |
] |
5184 | 553 |
|
554 |
||
555 |
processAction (KickClient kickId) = do |
|
556 |
modify (\s -> s{clientIndex = Just kickId}) |
|
5214 | 557 |
clHost <- client's host |
558 |
currentTime <- io getCurrentTime |
|
559 |
mapM_ processAction [ |
|
8401
87410ae372f6
Server messages localization using Qt's l10n subsystem:
unc0rr
parents:
8396
diff
changeset
|
560 |
AddIP2Bans clHost (loc "60 seconds cooldown after kick") (addUTCTime 60 currentTime) |
8245 | 561 |
, ModifyClient (\c -> c{isKickedFromServer = True}) |
13657
2d38dc2d3414
Tweak some connection failure messages
Wuzzy <Wuzzy2@mail.ru>
parents:
13506
diff
changeset
|
562 |
, ByeClient $ loc "Kicked" |
5214 | 563 |
] |
5184 | 564 |
|
565 |
||
566 |
processAction (BanClient seconds reason banId) = do |
|
567 |
modify (\s -> s{clientIndex = Just banId}) |
|
568 |
clHost <- client's host |
|
569 |
currentTime <- io getCurrentTime |
|
5426
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5214
diff
changeset
|
570 |
let msg = B.concat ["Ban for ", B.pack . show $ seconds, " (", reason, ")"] |
5184 | 571 |
mapM_ processAction [ |
572 |
AddIP2Bans clHost msg (addUTCTime seconds currentTime) |
|
573 |
, KickClient banId |
|
574 |
] |
|
575 |
||
8245 | 576 |
|
5426
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5214
diff
changeset
|
577 |
processAction (BanIP ip seconds reason) = do |
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5214
diff
changeset
|
578 |
currentTime <- io getCurrentTime |
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5214
diff
changeset
|
579 |
let msg = B.concat ["Ban for ", B.pack . show $ seconds, " (", reason, ")"] |
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5214
diff
changeset
|
580 |
processAction $ |
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5214
diff
changeset
|
581 |
AddIP2Bans ip msg (addUTCTime seconds currentTime) |
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5214
diff
changeset
|
582 |
|
8245 | 583 |
|
8154 | 584 |
processAction (BanNick n seconds reason) = do |
585 |
currentTime <- io getCurrentTime |
|
10017 | 586 |
let msg = |
8154 | 587 |
if seconds > 60 * 60 * 24 * 365 then |
588 |
B.concat ["Permanent ban (", reason, ")"] |
|
589 |
else |
|
590 |
B.concat ["Ban for ", B.pack . show $ seconds, " (", reason, ")"] |
|
591 |
processAction $ |
|
592 |
AddNick2Bans n msg (addUTCTime seconds currentTime) |
|
593 |
||
8245 | 594 |
|
5426
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5214
diff
changeset
|
595 |
processAction BanList = do |
8156 | 596 |
time <- io $ getCurrentTime |
5426
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5214
diff
changeset
|
597 |
ch <- client's sendChan |
8156 | 598 |
b <- gets (B.intercalate "\n" . concatMap (ban2Str time) . bans . serverInfo) |
5426
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5214
diff
changeset
|
599 |
processAction $ |
7766 | 600 |
AnswerClients [ch] ["BANLIST", b] |
8156 | 601 |
where |
602 |
ban2Str time (BanByIP b r t) = ["I", b, r, B.pack . show $ t `diffUTCTime` time] |
|
603 |
ban2Str time (BanByNick b r t) = ["N", b, r, B.pack . show $ t `diffUTCTime` time] |
|
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
604 |
|
8245 | 605 |
|
7748 | 606 |
processAction (Unban entry) = do |
8156 | 607 |
processAction $ ModifyServerInfo (\s -> s{bans = filter (not . f) $ bans s}) |
7748 | 608 |
where |
609 |
f (BanByIP bip _ _) = bip == entry |
|
610 |
f (BanByNick bn _ _) = bn == entry |
|
5184 | 611 |
|
8245 | 612 |
|
5184 | 613 |
processAction (KickRoomClient kickId) = do |
614 |
modify (\s -> s{clientIndex = Just kickId}) |
|
615 |
ch <- client's sendChan |
|
8401
87410ae372f6
Server messages localization using Qt's l10n subsystem:
unc0rr
parents:
8396
diff
changeset
|
616 |
mapM_ processAction [AnswerClients [ch] ["KICKED"], MoveToLobby $ loc "kicked"] |
5184 | 617 |
|
618 |
||
619 |
processAction (AddClient cl) = do |
|
620 |
rnc <- gets roomsClients |
|
621 |
si <- gets serverInfo |
|
622 |
newClId <- io $ do |
|
623 |
ci <- addClient rnc cl |
|
10259
c85d241d9cc9
committing patch from issue 798, as requested by unC0Rr
sheepluva
parents:
10216
diff
changeset
|
624 |
_ <- Exception.mask (\x -> forkIO $ clientRecvLoop (clientSocket cl) (coreChan si) (sendChan cl) ci x) |
5184 | 625 |
|
626 |
infoM "Clients" (show ci ++ ": New client. Time: " ++ show (connectTime cl)) |
|
627 |
||
628 |
return ci |
|
629 |
||
630 |
modify (\s -> s{clientIndex = Just newClId}) |
|
9973
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
631 |
|
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
632 |
jm <- gets joinsMonitor |
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
633 |
pass <- io $ joinsSentry jm (host cl) (connectTime cl) |
5184 | 634 |
|
9973
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
635 |
if pass then |
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
636 |
mapM_ processAction |
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
637 |
[ |
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
638 |
CheckBanned True |
13506
36f3f77e9b1b
Switch from http:// to https:// URLs where possible
Wuzzy <Wuzzy2@mail.ru>
parents:
13418
diff
changeset
|
639 |
, AnswerClients [sendChan cl] ["CONNECTED", "Hedgewars server https://www.hedgewars.org/", serverVersion] |
9973
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
640 |
] |
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
641 |
else |
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
642 |
processAction $ ByeClient $ loc "Reconnected too fast" |
5184 | 643 |
|
644 |
processAction (AddNick2Bans n reason expiring) = do |
|
645 |
processAction $ ModifyServerInfo (\s -> s{bans = BanByNick n reason expiring : bans s}) |
|
646 |
||
647 |
processAction (AddIP2Bans ip reason expiring) = do |
|
648 |
(Just ci) <- gets clientIndex |
|
649 |
rc <- gets removedClients |
|
650 |
when (not $ ci `Set.member` rc) |
|
651 |
$ processAction $ ModifyServerInfo (\s -> s{bans = BanByIP ip reason expiring : bans s}) |
|
652 |
||
8519
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8514
diff
changeset
|
653 |
|
8239 | 654 |
processAction (CheckBanned byIP) = do |
5184 | 655 |
clTime <- client's connectTime |
656 |
clNick <- client's nick |
|
657 |
clHost <- client's host |
|
658 |
si <- gets serverInfo |
|
10148 | 659 |
let (validBans, expiredBans) = L.partition (checkNotExpired clTime) $ bans si |
8239 | 660 |
let ban = L.find (checkBan byIP clHost clNick) $ validBans |
5426
109e9b5761c2
Implement command for banning by ip and a command for bans list
unc0rr
parents:
5214
diff
changeset
|
661 |
mapM_ processAction $ |
10148 | 662 |
[ModifyServerInfo (\s -> s{bans = validBans}) | not $ null expiredBans] |
663 |
++ [ByeClient (getBanReason $ fromJust ban) | isJust ban] |
|
5184 | 664 |
where |
665 |
checkNotExpired testTime (BanByIP _ _ time) = testTime `diffUTCTime` time <= 0 |
|
666 |
checkNotExpired testTime (BanByNick _ _ time) = testTime `diffUTCTime` time <= 0 |
|
11854 | 667 |
checkBan True ip _ (BanByIP bip _ _) = isMatch bip ip |
668 |
checkBan False _ n (BanByNick bn _ _) = isMatch bn n |
|
8239 | 669 |
checkBan _ _ _ _ = False |
11854 | 670 |
isMatch :: B.ByteString -> B.ByteString -> Bool |
14685 | 671 |
isMatch rexp src = (==) (Just True) $ mrexp rexp >>= flip matchM src |
11854 | 672 |
mrexp :: B.ByteString -> Maybe TDFAB.Regex |
673 |
mrexp = makeRegexOptsM TDFA.defaultCompOpt{TDFA.caseSensitive = False} TDFA.defaultExecOpt |
|
5184 | 674 |
getBanReason (BanByIP _ msg _) = msg |
675 |
getBanReason (BanByNick _ msg _) = msg |
|
676 |
||
8519
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8514
diff
changeset
|
677 |
|
5184 | 678 |
processAction PingAll = do |
679 |
rnc <- gets roomsClients |
|
680 |
io (allClientsM rnc) >>= mapM_ (kickTimeouted rnc) |
|
681 |
cis <- io $ allClientsM rnc |
|
682 |
chans <- io $ mapM (client'sM rnc sendChan) cis |
|
683 |
io $ mapM_ (modifyClient rnc (\cl -> cl{pingsQueue = pingsQueue cl + 1})) cis |
|
684 |
processAction $ AnswerClients chans ["PING"] |
|
685 |
where |
|
686 |
kickTimeouted rnc ci = do |
|
687 |
pq <- io $ client'sM rnc pingsQueue ci |
|
7465
c2dcf97ca664
Okay, this is workaround over ping timeouts problem on the server. Could make server crash if recieve thread wakes up after second ping timeout event.
unc0rr
parents:
7351
diff
changeset
|
688 |
when (pq > 0) $ do |
5184 | 689 |
withStateT (\as -> as{clientIndex = Just ci}) $ |
8401
87410ae372f6
Server messages localization using Qt's l10n subsystem:
unc0rr
parents:
8396
diff
changeset
|
690 |
processAction (ByeClient $ loc "Ping timeout") |
7600
31a177d2856c
Disable workaround, as it still makes server crash and hung clients are hidden from players anyway
unc0rr
parents:
7537
diff
changeset
|
691 |
-- when (pq > 1) $ |
31a177d2856c
Disable workaround, as it still makes server crash and hung clients are hidden from players anyway
unc0rr
parents:
7537
diff
changeset
|
692 |
-- processAction $ DeleteClient ci -- smth went wrong with client io threads, issue DeleteClient here |
5184 | 693 |
|
694 |
||
695 |
processAction StatsAction = do |
|
5211 | 696 |
si <- gets serverInfo |
697 |
when (not $ shutdownPending si) $ do |
|
5212
eaffb02f0053
Don't perform RestartServer action when already did it once
unc0rr
parents:
5211
diff
changeset
|
698 |
rnc <- gets roomsClients |
eaffb02f0053
Don't perform RestartServer action when already did it once
unc0rr
parents:
5211
diff
changeset
|
699 |
(roomsNum, clientsNum) <- io $ withRoomsAndClients rnc st |
eaffb02f0053
Don't perform RestartServer action when already did it once
unc0rr
parents:
5211
diff
changeset
|
700 |
io $ writeChan (dbQueries si) $ SendStats clientsNum (roomsNum - 1) |
5184 | 701 |
where |
702 |
st irnc = (length $ allRooms irnc, length $ allClients irnc) |
|
703 |
||
9435 | 704 |
|
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
705 |
processAction RestartServer = do |
5212
eaffb02f0053
Don't perform RestartServer action when already did it once
unc0rr
parents:
5211
diff
changeset
|
706 |
sp <- gets (shutdownPending . serverInfo) |
eaffb02f0053
Don't perform RestartServer action when already did it once
unc0rr
parents:
5211
diff
changeset
|
707 |
when (not sp) $ do |
eaffb02f0053
Don't perform RestartServer action when already did it once
unc0rr
parents:
5211
diff
changeset
|
708 |
sock <- gets (fromJust . serverSocket . serverInfo) |
eaffb02f0053
Don't perform RestartServer action when already did it once
unc0rr
parents:
5211
diff
changeset
|
709 |
args <- gets (runArgs . serverInfo) |
eaffb02f0053
Don't perform RestartServer action when already did it once
unc0rr
parents:
5211
diff
changeset
|
710 |
io $ do |
eaffb02f0053
Don't perform RestartServer action when already did it once
unc0rr
parents:
5211
diff
changeset
|
711 |
noticeM "Core" "Closing listening socket" |
15699 | 712 |
close sock |
5212
eaffb02f0053
Don't perform RestartServer action when already did it once
unc0rr
parents:
5211
diff
changeset
|
713 |
noticeM "Core" "Spawning new server" |
eaffb02f0053
Don't perform RestartServer action when already did it once
unc0rr
parents:
5211
diff
changeset
|
714 |
_ <- createProcess (proc "./hedgewars-server" args) |
eaffb02f0053
Don't perform RestartServer action when already did it once
unc0rr
parents:
5211
diff
changeset
|
715 |
return () |
eaffb02f0053
Don't perform RestartServer action when already did it once
unc0rr
parents:
5211
diff
changeset
|
716 |
processAction $ ModifyServerInfo (\s -> s{shutdownPending = True}) |
5184 | 717 |
|
9435 | 718 |
|
8403
fbc6e7602e05
- Allow server admins to use DELEGATE even when not room owner
unc0rr
parents:
8401
diff
changeset
|
719 |
processAction Stats = do |
fbc6e7602e05
- Allow server admins to use DELEGATE even when not room owner
unc0rr
parents:
8401
diff
changeset
|
720 |
cls <- allClientsS |
8452 | 721 |
rms <- allRoomsS |
722 |
let clientsMap = Map.fromListWith (+) . map (\c -> (clientProto c, 1 :: Int)) $ cls |
|
723 |
let roomsMap = Map.fromListWith (+) . map (\c -> (roomProto c, 1 :: Int)) . filter ((/=) 0 . roomProto) $ rms |
|
724 |
let keys = Map.keysSet clientsMap `Set.union` Map.keysSet roomsMap |
|
725 |
let versionsStats = B.concat . ((:) "<table border=1>") . (flip (++) ["</table>"]) |
|
726 |
. concatMap (\p -> [ |
|
727 |
"<tr><td>", protoNumber2ver p |
|
728 |
, "</td><td>", showB $ Map.findWithDefault 0 p clientsMap |
|
729 |
, "</td><td>", showB $ Map.findWithDefault 0 p roomsMap |
|
730 |
, "</td></tr>"]) |
|
731 |
. Set.toList $ keys |
|
732 |
processAction $ Warning versionsStats |
|
733 |
||
8403
fbc6e7602e05
- Allow server admins to use DELEGATE even when not room owner
unc0rr
parents:
8401
diff
changeset
|
734 |
|
9035
e84d42a4311c
'/rnd' command. Pass it a (possibly empty) list of items.
unc0rr
parents:
9032
diff
changeset
|
735 |
processAction (Random chans items) = do |
13730
5f62417a7d84
Translate "heads" and "tails" of gameServer
Wuzzy <Wuzzy2@mail.ru>
parents:
13728
diff
changeset
|
736 |
let i = if null items then [loc "heads", loc "tails"] else items |
9035
e84d42a4311c
'/rnd' command. Pass it a (possibly empty) list of items.
unc0rr
parents:
9032
diff
changeset
|
737 |
n <- io $ randomRIO (0, length i - 1) |
13730
5f62417a7d84
Translate "heads" and "tails" of gameServer
Wuzzy <Wuzzy2@mail.ru>
parents:
13728
diff
changeset
|
738 |
processAction $ AnswerClients chans ["CHAT", if null items then nickRandomCoin else nickRandomCustom, i !! n] |
9035
e84d42a4311c
'/rnd' command. Pass it a (possibly empty) list of items.
unc0rr
parents:
9032
diff
changeset
|
739 |
|
e84d42a4311c
'/rnd' command. Pass it a (possibly empty) list of items.
unc0rr
parents:
9032
diff
changeset
|
740 |
|
11575 | 741 |
processAction (LoadGhost location) = do |
742 |
ri <- clientRoomA |
|
743 |
rnc <- gets roomsClients |
|
744 |
thisRoomChans <- liftM (map sendChan) $ roomClientsS ri |
|
11581 | 745 |
#if defined(OFFICIAL_SERVER) |
11577
bee3a2f8e117
Finish implementation of ghost points served from server, not tested
unc0rr
parents:
11575
diff
changeset
|
746 |
rm <- io $ room'sM rnc id ri |
11580 | 747 |
points <- io $ loadFile (B.unpack $ "ghosts/" `B.append` sanitizeName location) |
11577
bee3a2f8e117
Finish implementation of ghost points served from server, not tested
unc0rr
parents:
11575
diff
changeset
|
748 |
when (roomProto rm > 51) $ do |
bee3a2f8e117
Finish implementation of ghost points served from server, not tested
unc0rr
parents:
11575
diff
changeset
|
749 |
processAction $ ModifyRoom $ \r -> r{params = Map.insert "DRAWNMAP" [prependGhostPoints (toP points) $ head $ (params r) Map.! "DRAWNMAP"] (params r)} |
11580 | 750 |
#endif |
11575 | 751 |
cl <- client's id |
11581 | 752 |
rm <- io $ room'sM rnc id ri |
11577
bee3a2f8e117
Finish implementation of ghost points served from server, not tested
unc0rr
parents:
11575
diff
changeset
|
753 |
mapM_ processAction $ map (replaceChans thisRoomChans) $ answerFullConfigParams cl (mapParams rm) (params rm) |
11575 | 754 |
where |
755 |
loadFile :: String -> IO [Int] |
|
756 |
loadFile fileName = E.handle (\(e :: SomeException) -> return []) $ do |
|
757 |
points <- liftM read $ readFile fileName |
|
758 |
return (points `deepseq` points) |
|
759 |
replaceChans chans (AnswerClients _ msg) = AnswerClients chans msg |
|
760 |
replaceChans _ a = a |
|
11577
bee3a2f8e117
Finish implementation of ghost points served from server, not tested
unc0rr
parents:
11575
diff
changeset
|
761 |
toP [] = [] |
bee3a2f8e117
Finish implementation of ghost points served from server, not tested
unc0rr
parents:
11575
diff
changeset
|
762 |
toP (p1:p2:ps) = (fromIntegral p1, fromIntegral p2) : toP ps |
11575 | 763 |
{- |
764 |
let a = map (replaceChans chans) $ answerFullConfigParams cl mp p |
|
765 |
-} |
|
6012 | 766 |
#if defined(OFFICIAL_SERVER) |
5184 | 767 |
processAction SaveReplay = do |
768 |
ri <- clientRoomA |
|
769 |
rnc <- gets roomsClients |
|
8371 | 770 |
|
9437 | 771 |
readyCheckersIds <- io $ do |
5184 | 772 |
r <- room'sM rnc id ri |
773 |
saveReplay r |
|
9437 | 774 |
allci <- allClientsM rnc |
775 |
filterM (client'sM rnc isReadyChecker) allci |
|
9433 | 776 |
|
777 |
when (not $ null readyCheckersIds) $ do |
|
9439 | 778 |
oldci <- gets clientIndex |
779 |
withStateT (\s -> s{clientIndex = Just $ head readyCheckersIds}) |
|
780 |
$ processAction CheckRecord |
|
781 |
modify (\s -> s{clientIndex = oldci}) |
|
9433 | 782 |
where |
783 |
isReadyChecker cl = isChecker cl && isReady cl |
|
8479
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
8476
diff
changeset
|
784 |
|
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
8476
diff
changeset
|
785 |
|
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
8476
diff
changeset
|
786 |
processAction CheckRecord = do |
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
8476
diff
changeset
|
787 |
p <- client's clientProto |
8482 | 788 |
c <- client's sendChan |
9662
47dbd9601342
Ensure checkers don't check same replay simultaneously
unc0rr
parents:
9528
diff
changeset
|
789 |
ri <- clientRoomA |
47dbd9601342
Ensure checkers don't check same replay simultaneously
unc0rr
parents:
9528
diff
changeset
|
790 |
rnc <- gets roomsClients |
47dbd9601342
Ensure checkers don't check same replay simultaneously
unc0rr
parents:
9528
diff
changeset
|
791 |
|
47dbd9601342
Ensure checkers don't check same replay simultaneously
unc0rr
parents:
9528
diff
changeset
|
792 |
blackList <- liftM (map (recordFileName . fromJust . checkInfo) . filter (isJust . checkInfo)) allClientsS |
47dbd9601342
Ensure checkers don't check same replay simultaneously
unc0rr
parents:
9528
diff
changeset
|
793 |
|
47dbd9601342
Ensure checkers don't check same replay simultaneously
unc0rr
parents:
9528
diff
changeset
|
794 |
(cinfo, l) <- io $ loadReplay (fromIntegral p) blackList |
10086 | 795 |
when (isJust cinfo) $ |
8509 | 796 |
mapM_ processAction [ |
797 |
AnswerClients [c] ("REPLAY" : l) |
|
9444 | 798 |
, ModifyClient $ \c -> c{checkInfo = cinfo, isReady = False} |
8509 | 799 |
] |
8479
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
8476
diff
changeset
|
800 |
|
9433 | 801 |
|
8509 | 802 |
processAction (CheckFailed msg) = do |
11246
09a2d3988569
Also pass script information alongwith winner/achievements info, so that we could potentially have per mode ratings
unc0rr
parents:
11046
diff
changeset
|
803 |
Just (CheckInfo fileName _ _) <- client's checkInfo |
8509 | 804 |
io $ moveFailedRecord fileName |
8507 | 805 |
|
9433 | 806 |
|
8509 | 807 |
processAction (CheckSuccess info) = do |
11320
556eafd1443a
Store some more details on game config in the database
unc0rr
parents:
11246
diff
changeset
|
808 |
Just (CheckInfo fileName teams gameDetails) <- client's checkInfo |
9868 | 809 |
p <- client's clientProto |
9401 | 810 |
si <- gets serverInfo |
11320
556eafd1443a
Store some more details on game config in the database
unc0rr
parents:
11246
diff
changeset
|
811 |
when (isJust gameDetails) |
556eafd1443a
Store some more details on game config in the database
unc0rr
parents:
11246
diff
changeset
|
812 |
$ io $ writeChan (dbQueries si) $ StoreAchievements p (B.pack fileName) (map toPair teams) (fromJust gameDetails) info |
8509 | 813 |
io $ moveCheckedRecord fileName |
9399 | 814 |
where |
815 |
toPair t = (teamname t, teamowner t) |
|
8507 | 816 |
|
9786 | 817 |
processAction (QueryReplay rname) = do |
9446 | 818 |
(Just ci) <- gets clientIndex |
819 |
si <- gets serverInfo |
|
820 |
uid <- client's clUID |
|
9786 | 821 |
io $ writeChan (dbQueries si) $ GetReplayName ci (hashUnique uid) rname |
9446 | 822 |
|
9786 | 823 |
processAction (ShowReplay rname) = do |
9448 | 824 |
c <- client's sendChan |
825 |
cl <- client's id |
|
826 |
||
9786 | 827 |
let fileName = B.concat ["checked/", if B.isPrefixOf "replays/" rname then B.drop 8 rname else rname] |
9448 | 828 |
|
9786 | 829 |
cInfo <- liftIO $ E.handle (\(e :: SomeException) -> |
9448 | 830 |
warningM "REPLAYS" (B.unpack $ B.concat ["Problems reading ", fileName, ": ", B.pack $ show e]) >> return Nothing) $ do |
831 |
(t, p1, p2, msgs) <- liftM read $ readFile (B.unpack fileName) |
|
832 |
return $ Just (t, Map.fromList p1, Map.fromList p2, reverse msgs) |
|
9446 | 833 |
|
9786 | 834 |
let (teams', params1, params2, roundMsgs') = fromJust cInfo |
9448 | 835 |
|
9786 | 836 |
when (isJust cInfo) $ do |
14905
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
837 |
mapM_ processAction $ |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
838 |
if clientProto cl < 58 then |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
839 |
concat [ |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
840 |
[AnswerClients [c] ["JOINED", nick cl]] |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
841 |
, answerFullConfigParams cl params1 params2 |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
842 |
, answerAllTeams cl teams' |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
843 |
, [AnswerClients [c] ["RUN_GAME"]] |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
844 |
, [AnswerClients [c] $ "EM" : roundMsgs'] |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
845 |
, [AnswerClients [c] ["KICKED"]] |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
846 |
] |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
847 |
else |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
848 |
concat [ |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
849 |
[AnswerClients [c] ["REPLAY_START"]] |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
850 |
, answerFullConfigParams cl params1 params2 |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
851 |
, answerAllTeams cl teams' |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
852 |
, [AnswerClients [c] ["RUN_GAME"]] |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
853 |
, [AnswerClients [c] $ "EM" : roundMsgs'] |
6b591186ab10
Server /watch: Add back KICKED for old clients, remove REPLAY_START parameter
Wuzzy <Wuzzy2@mail.ru>
parents:
14904
diff
changeset
|
854 |
] |
9973
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
855 |
|
10195 | 856 |
processAction (SaveRoom rname) = do |
857 |
rnc <- gets roomsClients |
|
858 |
ri <- clientRoomA |
|
859 |
rm <- io $ room'sM rnc id ri |
|
13418 | 860 |
liftIO $ YAML.encodeFile (B.unpack rname) (greeting rm, roomSaves rm) |
10195 | 861 |
|
862 |
processAction (LoadRoom rname) = do |
|
13418 | 863 |
Right (g, rs) <- io $ YAML.decodeFileEither (B.unpack rname) |
10195 | 864 |
processAction $ ModifyRoom $ \r -> r{greeting = g, roomSaves = rs} |
14359 | 865 |
|
14287
9f0d81213d65
Cut dependency on yaml for non-official server builds
unC0Rr
parents:
13730
diff
changeset
|
866 |
#else |
9f0d81213d65
Cut dependency on yaml for non-official server builds
unC0Rr
parents:
13730
diff
changeset
|
867 |
processAction SaveReplay = return () |
9f0d81213d65
Cut dependency on yaml for non-official server builds
unC0Rr
parents:
13730
diff
changeset
|
868 |
processAction CheckRecord = return () |
9f0d81213d65
Cut dependency on yaml for non-official server builds
unC0Rr
parents:
13730
diff
changeset
|
869 |
processAction (CheckFailed _) = return () |
9f0d81213d65
Cut dependency on yaml for non-official server builds
unC0Rr
parents:
13730
diff
changeset
|
870 |
processAction (CheckSuccess _) = return () |
9f0d81213d65
Cut dependency on yaml for non-official server builds
unC0Rr
parents:
13730
diff
changeset
|
871 |
processAction (QueryReplay _) = processAction $ Warning $ loc "This server does not support replays!" |
9f0d81213d65
Cut dependency on yaml for non-official server builds
unC0Rr
parents:
13730
diff
changeset
|
872 |
processAction (ShowReplay rname) = return () |
15408
d9a12aba5c05
GameServer: Hide saveroom and loadroom command in non-official server
Wuzzy <Wuzzy2@mail.ru>
parents:
14905
diff
changeset
|
873 |
processAction (SaveRoom rname) = return () -- TODO: Send warning that this command is unsupported |
d9a12aba5c05
GameServer: Hide saveroom and loadroom command in non-official server
Wuzzy <Wuzzy2@mail.ru>
parents:
14905
diff
changeset
|
874 |
processAction (LoadRoom rname) = return () -- TODO: Send warning that this command is unsupported |
14287
9f0d81213d65
Cut dependency on yaml for non-official server builds
unC0Rr
parents:
13730
diff
changeset
|
875 |
#endif |
9973
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
876 |
|
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
877 |
processAction Cleanup = do |
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
878 |
jm <- gets joinsMonitor |
10017 | 879 |
|
9973
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
880 |
io $ do |
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
881 |
t <- getCurrentTime |
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9868
diff
changeset
|
882 |
cleanup jm t |
10090 | 883 |
|
884 |
||
885 |
processAction (RegisterEvent e) = do |
|
886 |
actions <- registerEvent e |
|
887 |
mapM_ processAction actions |
|
10212 | 888 |
|
889 |
||
890 |
processAction (ReactCmd cmd) = do |
|
891 |
(Just ci) <- gets clientIndex |
|
892 |
rnc <- gets roomsClients |
|
893 |
actions <- liftIO $ withRoomsAndClients rnc (\irnc -> runReader (handleCmd cmd) (ci, irnc)) |
|
894 |
forM_ (actions `deepseq` actions) processAction |
|
10215 | 895 |
|
896 |
processAction CheckVotes = |
|
11575 | 897 |
checkVotes >>= mapM_ processAction |
14380
8ad85859dd3f
/registered_only now tells in chat whether the state is on or off
Wuzzy <Wuzzy2@mail.ru>
parents:
14359
diff
changeset
|
898 |
|
8ad85859dd3f
/registered_only now tells in chat whether the state is on or off
Wuzzy <Wuzzy2@mail.ru>
parents:
14359
diff
changeset
|
899 |
processAction (ShowRegisteredOnlyState chans) = do |
8ad85859dd3f
/registered_only now tells in chat whether the state is on or off
Wuzzy <Wuzzy2@mail.ru>
parents:
14359
diff
changeset
|
900 |
si <- gets serverInfo |
8ad85859dd3f
/registered_only now tells in chat whether the state is on or off
Wuzzy <Wuzzy2@mail.ru>
parents:
14359
diff
changeset
|
901 |
processAction $ AnswerClients chans |
8ad85859dd3f
/registered_only now tells in chat whether the state is on or off
Wuzzy <Wuzzy2@mail.ru>
parents:
14359
diff
changeset
|
902 |
["CHAT", nickServer, |
8ad85859dd3f
/registered_only now tells in chat whether the state is on or off
Wuzzy <Wuzzy2@mail.ru>
parents:
14359
diff
changeset
|
903 |
if isRegisteredUsersOnly si then |
8ad85859dd3f
/registered_only now tells in chat whether the state is on or off
Wuzzy <Wuzzy2@mail.ru>
parents:
14359
diff
changeset
|
904 |
loc "This server no longer allows unregistered players to join." |
8ad85859dd3f
/registered_only now tells in chat whether the state is on or off
Wuzzy <Wuzzy2@mail.ru>
parents:
14359
diff
changeset
|
905 |
else |
8ad85859dd3f
/registered_only now tells in chat whether the state is on or off
Wuzzy <Wuzzy2@mail.ru>
parents:
14359
diff
changeset
|
906 |
loc "This server now allows unregistered players to join." |
8ad85859dd3f
/registered_only now tells in chat whether the state is on or off
Wuzzy <Wuzzy2@mail.ru>
parents:
14359
diff
changeset
|
907 |
] |