author | unc0rr |
Sat, 11 Apr 2015 15:34:07 +0300 | |
changeset 10909 | 594f59bd1751 |
parent 10882 | ed7717f659ae |
child 10977 | b2823ea26631 |
permissions | -rw-r--r-- |
10460
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10392
diff
changeset
|
1 |
{- |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10392
diff
changeset
|
2 |
* Hedgewars, a free turn based strategy game |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10392
diff
changeset
|
3 |
* Copyright (c) 2004-2014 Andrey Korotaev <unC0Rr@gmail.com> |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10392
diff
changeset
|
4 |
* |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10392
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:
10392
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:
10392
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10392
diff
changeset
|
8 |
* |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10392
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:
10392
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:
10392
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10392
diff
changeset
|
12 |
* GNU General Public License for more details. |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10392
diff
changeset
|
13 |
* |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10392
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:
10392
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:
10392
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:
10392
diff
changeset
|
17 |
\-} |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10392
diff
changeset
|
18 |
|
8519
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
19 |
{-# LANGUAGE CPP, OverloadedStrings, DeriveDataTypeable #-} |
1804 | 20 |
module CoreTypes where |
21 |
||
4579
4e61c2a42121
Explicitly kill listening thread in try to prevent messages recieving bugs
unc0rr
parents:
4337
diff
changeset
|
22 |
import Control.Concurrent |
1804 | 23 |
import Data.Word |
24 |
import qualified Data.Map as Map |
|
1926
cb46fbdcaa41
Add simple DoS protection mechanism (although better than previous server had)
unc0rr
parents:
1921
diff
changeset
|
25 |
import Data.Time |
1804 | 26 |
import Network |
2352 | 27 |
import Data.Function |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
28 |
import Data.ByteString.Char8 as B |
4918
c6d3aec73f93
Add Unique field to Client structure, and use it to check for matching recieved account status with client
unc0rr
parents:
4907
diff
changeset
|
29 |
import Data.Unique |
4959 | 30 |
import Control.Exception |
31 |
import Data.Typeable |
|
4989 | 32 |
import Data.TConfig |
8519
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
33 |
import Control.DeepSeq |
4959 | 34 |
----------------------- |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
35 |
import RoomsAndClients |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
36 |
|
8519
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
37 |
#if __GLASGOW_HASKELL__ < 706 |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
38 |
instance NFData B.ByteString |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
39 |
#endif |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
40 |
|
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
41 |
instance NFData (Chan a) |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
42 |
|
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
43 |
instance NFData Action where |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
44 |
rnf (AnswerClients chans msg) = chans `deepseq` msg `deepseq` () |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
45 |
rnf a = a `seq` () |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
46 |
|
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
47 |
data Action = |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
48 |
AnswerClients ![ClientChan] ![B.ByteString] |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
49 |
| SendServerMessage |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
50 |
| SendServerVars |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
51 |
| MoveToRoom RoomIndex |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
52 |
| MoveToLobby B.ByteString |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
53 |
| RemoveTeam B.ByteString |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
54 |
| SendTeamRemovalMessage B.ByteString |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
55 |
| RemoveRoom |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
56 |
| FinishGame |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
57 |
| UnreadyRoomClients |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
58 |
| JoinLobby |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
59 |
| ProtocolError B.ByteString |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
60 |
| Warning B.ByteString |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
61 |
| NoticeMessage Notice |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
62 |
| ByeClient B.ByteString |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
63 |
| KickClient ClientIndex |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
64 |
| KickRoomClient ClientIndex |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
65 |
| BanClient NominalDiffTime B.ByteString ClientIndex |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
66 |
| BanIP B.ByteString NominalDiffTime B.ByteString |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
67 |
| BanNick B.ByteString NominalDiffTime B.ByteString |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
68 |
| BanList |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
69 |
| Unban B.ByteString |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
70 |
| ChangeMaster (Maybe ClientIndex) |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
71 |
| RemoveClientTeams |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
72 |
| ModifyClient (ClientInfo -> ClientInfo) |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
73 |
| ModifyClient2 ClientIndex (ClientInfo -> ClientInfo) |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
74 |
| ModifyRoomClients (ClientInfo -> ClientInfo) |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
75 |
| ModifyRoom (RoomInfo -> RoomInfo) |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
76 |
| ModifyServerInfo (ServerInfo -> ServerInfo) |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
77 |
| AddRoom B.ByteString B.ByteString |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
78 |
| SendUpdateOnThisRoom |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
79 |
| CheckRegistered |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
80 |
| ClearAccountsCache |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
81 |
| ProcessAccountInfo AccountInfo |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
82 |
| AddClient ClientInfo |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
83 |
| DeleteClient ClientIndex |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
84 |
| PingAll |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
85 |
| StatsAction |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
86 |
| RestartServer |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
87 |
| AddNick2Bans B.ByteString B.ByteString UTCTime |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
88 |
| AddIP2Bans B.ByteString B.ByteString UTCTime |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
89 |
| CheckBanned Bool |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
90 |
| SaveReplay |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
91 |
| Stats |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
92 |
| CheckRecord |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
93 |
| CheckFailed B.ByteString |
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
94 |
| CheckSuccess [B.ByteString] |
9035
e84d42a4311c
'/rnd' command. Pass it a (possibly empty) list of items.
unc0rr
parents:
8897
diff
changeset
|
95 |
| Random [ClientChan] [B.ByteString] |
9446 | 96 |
| QueryReplay B.ByteString |
97 |
| ShowReplay B.ByteString |
|
9973
7589978c9912
Stub for joins monitor which is a replacement to plain ban for 10 seconds system after join
unc0rr
parents:
9884
diff
changeset
|
98 |
| Cleanup |
10090 | 99 |
| RegisterEvent Event |
10195 | 100 |
| SaveRoom B.ByteString |
101 |
| LoadRoom B.ByteString |
|
10212 | 102 |
| ReactCmd [B.ByteString] |
10215 | 103 |
| CheckVotes |
10786
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
104 |
| SetRandomSeed |
10090 | 105 |
|
106 |
||
107 |
data Event = LobbyChatMessage |
|
108 |
| EngineMessage |
|
109 |
| RoomJoin |
|
10094 | 110 |
|
111 |
type EventsInfo = [(Int, UTCTime)] |
|
8519
98e2dbdda8c0
Workaround desync issue if I correctly understand its roots (barely tested)
unc0rr
parents:
8509
diff
changeset
|
112 |
|
10093 | 113 |
newEventsInfo :: EventsInfo |
10786
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
114 |
newEventsInfo = [] |
10212 | 115 |
|
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
116 |
type ClientChan = Chan [B.ByteString] |
3435 | 117 |
|
8507 | 118 |
data CheckInfo = |
119 |
CheckInfo |
|
120 |
{ |
|
8509 | 121 |
recordFileName :: String, |
8507 | 122 |
recordTeams :: [TeamInfo] |
123 |
} |
|
124 |
||
1804 | 125 |
data ClientInfo = |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
126 |
ClientInfo |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
127 |
{ |
4918
c6d3aec73f93
Add Unique field to Client structure, and use it to check for matching recieved account status with client
unc0rr
parents:
4907
diff
changeset
|
128 |
clUID :: Unique, |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
129 |
sendChan :: ClientChan, |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
130 |
clientSocket :: Socket, |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
131 |
host :: B.ByteString, |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
132 |
connectTime :: UTCTime, |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
133 |
nick :: B.ByteString, |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
134 |
webPassword :: B.ByteString, |
10076 | 135 |
serverSalt :: B.ByteString, |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
136 |
logonPassed :: Bool, |
8372
3c193ec03e09
Logon procedure for checkers, introduce invisible clients
unc0rr
parents:
8371
diff
changeset
|
137 |
isVisible :: Bool, |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
138 |
clientProto :: !Word16, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
139 |
pingsQueue :: !Word, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
140 |
isMaster :: Bool, |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
141 |
isReady :: !Bool, |
7757
c20e6c80e249
Don't accept ROUNDFINISHED message twice. Fixes game hangs when half of teams quit game.
unc0rr
parents:
7537
diff
changeset
|
142 |
isInGame :: Bool, |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
143 |
isAdministrator :: Bool, |
8371 | 144 |
isChecker :: Bool, |
9435 | 145 |
isContributor :: Bool, |
8245 | 146 |
isKickedFromServer :: Bool, |
9109
878f06e9c484
- Fix issue 521 by resending FULLMAPCONFIG on game finish to those who joined mid-game. Semitested.
unc0rr
parents:
9086
diff
changeset
|
147 |
isJoinedMidGame :: Bool, |
8433 | 148 |
clientClan :: !(Maybe B.ByteString), |
8507 | 149 |
checkInfo :: Maybe CheckInfo, |
10093 | 150 |
eiLobbyChat, |
151 |
eiEM, |
|
152 |
eiJoin :: EventsInfo, |
|
8897
d6c310c65c91
- Revert server workaround over desync from r98e2dbdda8c0
unc0rr
parents:
8519
diff
changeset
|
153 |
teamsInGame :: Word |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
154 |
} |
1804 | 155 |
|
156 |
instance Eq ClientInfo where |
|
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
157 |
(==) = (==) `on` clientSocket |
1804 | 158 |
|
159 |
data HedgehogInfo = |
|
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
160 |
HedgehogInfo B.ByteString B.ByteString |
5143
649d87819682
Start implementation of archivements/ratings on server side: replay saving routine
unc0rr
parents:
5007
diff
changeset
|
161 |
deriving (Show, Read) |
1804 | 162 |
|
163 |
data TeamInfo = |
|
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
164 |
TeamInfo |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
165 |
{ |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
166 |
teamowner :: B.ByteString, |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
167 |
teamname :: B.ByteString, |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
168 |
teamcolor :: B.ByteString, |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
169 |
teamgrave :: B.ByteString, |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
170 |
teamfort :: B.ByteString, |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
171 |
teamvoicepack :: B.ByteString, |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
172 |
teamflag :: B.ByteString, |
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:
10482
diff
changeset
|
173 |
isOwnerRegistered :: Bool, |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
174 |
difficulty :: Int, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
175 |
hhnum :: Int, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
176 |
hedgehogs :: [HedgehogInfo] |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
177 |
} |
5143
649d87819682
Start implementation of archivements/ratings on server side: replay saving routine
unc0rr
parents:
5007
diff
changeset
|
178 |
deriving (Show, Read) |
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
179 |
|
8431 | 180 |
instance Eq TeamInfo where |
181 |
(==) = (==) `on` teamname |
|
8479
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
8433
diff
changeset
|
182 |
|
5996
2c72fe81dd37
Convert boolean variable + a bunch of fields which make sense only while game is going on into Maybe + structure
unc0rr
parents:
5210
diff
changeset
|
183 |
data GameInfo = |
2c72fe81dd37
Convert boolean variable + a bunch of fields which make sense only while game is going on into Maybe + structure
unc0rr
parents:
5210
diff
changeset
|
184 |
GameInfo |
2c72fe81dd37
Convert boolean variable + a bunch of fields which make sense only while game is going on into Maybe + structure
unc0rr
parents:
5210
diff
changeset
|
185 |
{ |
8369 | 186 |
roundMsgs :: [B.ByteString], |
9304
3f4c3fc146c2
Fix spectator desync in rare conditions (there was team which left during its turn, and last command with timestamp from it was '+')
unc0rr
parents:
9109
diff
changeset
|
187 |
lastFilteredTimedMsg :: Maybe B.ByteString, |
7126
8daa5c8e84c0
Bring leftTeams back (with a fix) as it is apparently needed for spectators.
unc0rr
parents:
7124
diff
changeset
|
188 |
leftTeams :: [B.ByteString], |
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
|
189 |
rejoinedTeams :: [B.ByteString], -- for 0.9.21 frontend workaround |
5996
2c72fe81dd37
Convert boolean variable + a bunch of fields which make sense only while game is going on into Maybe + structure
unc0rr
parents:
5210
diff
changeset
|
190 |
teamsAtStart :: [TeamInfo], |
6756
344d32bb1328
Also consider game finished when the last player reports ROUNDFINISHED despite the correctness parameter.
unc0rr
parents:
6737
diff
changeset
|
191 |
teamsInGameNumber :: Int, |
8428 | 192 |
allPlayersHaveRegisteredAccounts :: !Bool, |
6069 | 193 |
giMapParams :: Map.Map B.ByteString B.ByteString, |
10392 | 194 |
giParams :: Map.Map B.ByteString [B.ByteString], |
195 |
isPaused :: Bool |
|
6069 | 196 |
} deriving (Show, Read) |
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
197 |
|
7766 | 198 |
newGameInfo :: [TeamInfo] |
199 |
-> Int |
|
200 |
-> Bool |
|
201 |
-> Map.Map ByteString ByteString |
|
202 |
-> Map.Map ByteString [ByteString] |
|
10392 | 203 |
-> Bool |
7766 | 204 |
-> GameInfo |
7321
57bd4f201401
- Try sending remove message in 'finally' as a last resort
unc0rr
parents:
7126
diff
changeset
|
205 |
newGameInfo = |
5996
2c72fe81dd37
Convert boolean variable + a bunch of fields which make sense only while game is going on into Maybe + structure
unc0rr
parents:
5210
diff
changeset
|
206 |
GameInfo |
8369 | 207 |
[] |
9304
3f4c3fc146c2
Fix spectator desync in rare conditions (there was team which left during its turn, and last command with timestamp from it was '+')
unc0rr
parents:
9109
diff
changeset
|
208 |
Nothing |
7126
8daa5c8e84c0
Bring leftTeams back (with a fix) as it is apparently needed for spectators.
unc0rr
parents:
7124
diff
changeset
|
209 |
[] |
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
|
210 |
[] |
1804 | 211 |
|
10194 | 212 |
|
1804 | 213 |
data RoomInfo = |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
214 |
RoomInfo |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
215 |
{ |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9528
diff
changeset
|
216 |
masterID :: Maybe ClientIndex, |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
217 |
name :: B.ByteString, |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
218 |
password :: B.ByteString, |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
219 |
roomProto :: Word16, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
220 |
teams :: [TeamInfo], |
5996
2c72fe81dd37
Convert boolean variable + a bunch of fields which make sense only while game is going on into Maybe + structure
unc0rr
parents:
5210
diff
changeset
|
221 |
gameInfo :: Maybe GameInfo, |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
222 |
playersIn :: !Int, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
223 |
readyPlayers :: !Int, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
224 |
isRestrictedJoins :: Bool, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
225 |
isRestrictedTeams :: Bool, |
8232 | 226 |
isRegisteredOnly :: Bool, |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9528
diff
changeset
|
227 |
isSpecial :: Bool, |
10786
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
228 |
defaultHedgehogsNumber :: Int, |
10882
ed7717f659ae
- Fix ping timeouts after incorrect "/vote" commands (protocol violation)
unc0rr
parents:
10814
diff
changeset
|
229 |
teamsNumberLimit :: Int, |
9787 | 230 |
greeting :: B.ByteString, |
10041 | 231 |
voting :: Maybe Voting, |
8002 | 232 |
roomBansList :: ![B.ByteString], |
4941 | 233 |
mapParams :: Map.Map B.ByteString B.ByteString, |
10194 | 234 |
params :: Map.Map B.ByteString [B.ByteString], |
235 |
roomSaves :: Map.Map B.ByteString (Map.Map B.ByteString B.ByteString, Map.Map B.ByteString [B.ByteString]) |
|
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
236 |
} |
1804 | 237 |
|
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
238 |
newRoom :: RoomInfo |
4932 | 239 |
newRoom = |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
240 |
RoomInfo |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9528
diff
changeset
|
241 |
Nothing |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
242 |
"" |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
243 |
"" |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
244 |
0 |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
245 |
[] |
5996
2c72fe81dd37
Convert boolean variable + a bunch of fields which make sense only while game is going on into Maybe + structure
unc0rr
parents:
5210
diff
changeset
|
246 |
Nothing |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
247 |
0 |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
248 |
0 |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
249 |
False |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
250 |
False |
8232 | 251 |
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:
9528
diff
changeset
|
252 |
False |
10786
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
253 |
4 |
10882
ed7717f659ae
- Fix ping timeouts after incorrect "/vote" commands (protocol violation)
unc0rr
parents:
10814
diff
changeset
|
254 |
8 |
9787 | 255 |
"" |
10041 | 256 |
Nothing |
7537
833a0c34fafc
Room bans. They're more simple, than the global ones: if you ban someone, he is banned by ip in this room for the rest of the room lifetime. Not tested.
unc0rr
parents:
7321
diff
changeset
|
257 |
[] |
4941 | 258 |
( |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9528
diff
changeset
|
259 |
Map.fromList $ Prelude.zip |
10482 | 260 |
["FEATURE_SIZE", "MAP", "MAPGEN", "MAZE_SIZE", "SEED", "TEMPLATE"] |
261 |
["12", "+rnd+", "0", "0", "seed", "0"] |
|
4941 | 262 |
) |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9528
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:
9528
diff
changeset
|
264 |
Map.fromList $ Prelude.zip |
10066 | 265 |
["AMMO", "SCHEME", "SCRIPT", "THEME"] |
266 |
[["Default"], ["Default"], ["Normal"], ["avematan"]] |
|
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9528
diff
changeset
|
267 |
) |
10194 | 268 |
Map.empty |
9753
9579596cf471
- Special rooms which stay even when last player quits. Not useful for now, and can't be removed at all.
unc0rr
parents:
9528
diff
changeset
|
269 |
|
1804 | 270 |
|
271 |
data StatisticsInfo = |
|
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
272 |
StatisticsInfo |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
273 |
{ |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
274 |
playersNumber :: Int, |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
275 |
roomsNumber :: Int |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
276 |
} |
1804 | 277 |
|
4989 | 278 |
data ServerInfo = |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
279 |
ServerInfo |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
280 |
{ |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
281 |
isDedicated :: Bool, |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
282 |
serverMessage :: B.ByteString, |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
283 |
serverMessageForOldVersions :: B.ByteString, |
3260
b44b88908758
Allow to set motd for old client versions (not used yet, as server needs some refactoring)
unc0rr
parents:
2868
diff
changeset
|
284 |
latestReleaseVersion :: Word16, |
4988 | 285 |
earliestCompatibleVersion :: Word16, |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
286 |
listenPort :: PortNumber, |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
287 |
dbHost :: B.ByteString, |
4982
3572eaf14340
Add dbName parameter to .ini file, fix some warnings
unc0rr
parents:
4975
diff
changeset
|
288 |
dbName :: B.ByteString, |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
289 |
dbLogin :: B.ByteString, |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
290 |
dbPassword :: B.ByteString, |
5007 | 291 |
bans :: [BanInfo], |
5209
f7a610e2ef5f
On restart command close server socket and spawn new server, keep running until last client quits
unc0rr
parents:
5143
diff
changeset
|
292 |
shutdownPending :: Bool, |
5210 | 293 |
runArgs :: [String], |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
294 |
coreChan :: Chan CoreMessage, |
4975
31da8979e5b1
Use Data.TConfig to read and store server config in hedgewars.ini (a little bit of hate to the author for not exporting Conf type)
unc0rr
parents:
4960
diff
changeset
|
295 |
dbQueries :: Chan DBQuery, |
5209
f7a610e2ef5f
On restart command close server socket and spawn new server, keep running until last client quits
unc0rr
parents:
5143
diff
changeset
|
296 |
serverSocket :: Maybe Socket, |
4989 | 297 |
serverConfig :: Maybe Conf |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
298 |
} |
1804 | 299 |
|
300 |
||
5209
f7a610e2ef5f
On restart command close server socket and spawn new server, keep running until last client quits
unc0rr
parents:
5143
diff
changeset
|
301 |
newServerInfo :: Chan CoreMessage -> Chan DBQuery -> Maybe Socket -> Maybe Conf -> ServerInfo |
4932 | 302 |
newServerInfo = |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
303 |
ServerInfo |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
304 |
True |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
305 |
"<h2><p align=center><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p></h2>" |
9086 | 306 |
"<font color=yellow><h3 align=center>Hedgewars 0.9.19 is out! Please update.</h3><p align=center><a href=http://hedgewars.org/download.html>Download page here</a></font>" |
9884 | 307 |
47 -- latestReleaseVersion |
7862
bd76ca40db68
Choose first unused color for added team (addresses issue 431) + other small changes
unc0rr
parents:
7766
diff
changeset
|
308 |
41 -- earliestCompatibleVersion |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
309 |
46631 |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
310 |
"" |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
311 |
"" |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
312 |
"" |
4982
3572eaf14340
Add dbName parameter to .ini file, fix some warnings
unc0rr
parents:
4975
diff
changeset
|
313 |
"" |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
314 |
[] |
4955 | 315 |
False |
5210 | 316 |
[] |
1804 | 317 |
|
10041 | 318 |
data Voting = Voting { |
319 |
voteTTL :: Int, |
|
320 |
entitledToVote :: [Unique], |
|
321 |
votes :: [(Unique, Bool)], |
|
322 |
voteType :: VoteType |
|
323 |
} |
|
324 |
||
325 |
||
326 |
data VoteType = VoteKick B.ByteString |
|
10195 | 327 |
| VoteMap B.ByteString |
10392 | 328 |
| VotePause |
10786
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
329 |
| VoteNewSeed |
712283ed86e0
Implement /newseed and /hedgehogs commands. Only tested for building.
unc0rr
parents:
10732
diff
changeset
|
330 |
| VoteHedgehogsPerTeam Int |
10041 | 331 |
|
332 |
||
10058 | 333 |
newVoting :: VoteType -> Voting |
334 |
newVoting = Voting 2 [] [] |
|
10041 | 335 |
|
336 |
||
1839
5dd4cb7fd7e5
Server now send ASKPASSWORD command to frontend when user has web account
unc0rr
parents:
1833
diff
changeset
|
337 |
data AccountInfo = |
9435 | 338 |
HasAccount B.ByteString Bool Bool |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
339 |
| Guest |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
340 |
| Admin |
9446 | 341 |
| ReplayName B.ByteString |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
342 |
deriving (Show, Read) |
2116
dec7ead2d178
Bring back authentication to official server, now using separate process to perform database interaction
unc0rr
parents:
2104
diff
changeset
|
343 |
|
dec7ead2d178
Bring back authentication to official server, now using separate process to perform database interaction
unc0rr
parents:
2104
diff
changeset
|
344 |
data DBQuery = |
4918
c6d3aec73f93
Add Unique field to Client structure, and use it to check for matching recieved account status with client
unc0rr
parents:
4907
diff
changeset
|
345 |
CheckAccount ClientIndex Int B.ByteString B.ByteString |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
346 |
| ClearCache |
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
347 |
| SendStats Int Int |
9868 | 348 |
| StoreAchievements Word16 B.ByteString [(B.ByteString, B.ByteString)] [B.ByteString] |
9446 | 349 |
| GetReplayName ClientIndex Int B.ByteString |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
350 |
deriving (Show, Read) |
1839
5dd4cb7fd7e5
Server now send ASKPASSWORD command to frontend when user has web account
unc0rr
parents:
1833
diff
changeset
|
351 |
|
1804 | 352 |
data CoreMessage = |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
353 |
Accept ClientInfo |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
354 |
| ClientMessage (ClientIndex, [B.ByteString]) |
4918
c6d3aec73f93
Add Unique field to Client structure, and use it to check for matching recieved account status with client
unc0rr
parents:
4907
diff
changeset
|
355 |
| ClientAccountInfo ClientIndex Int AccountInfo |
2867
9be6693c78cb
- Unbreak support for client versions prior to 0.9.13-dev
unc0rr
parents:
2747
diff
changeset
|
356 |
| TimerAction Int |
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
357 |
| Remove ClientIndex |
1804 | 358 |
|
4295
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
359 |
type MRnC = MRoomsAndClients RoomInfo ClientInfo |
1f5604cd99be
This revision should, in theory, correctly merge 0.9.14 and tip, so that future merges of 0.9.14 should work properly
nemo
parents:
4242
diff
changeset
|
360 |
type IRnC = IRoomsAndClients RoomInfo ClientInfo |
1804 | 361 |
|
4622 | 362 |
data Notice = |
363 |
NickAlreadyInUse |
|
364 |
| AdminLeft |
|
6912
831416764d2d
Allow LIST command while in room to not annoy old frontends (0.9.17 or less) with warnings
unc0rr
parents:
6756
diff
changeset
|
365 |
| WrongPassword |
4959 | 366 |
deriving Enum |
367 |
||
4960 | 368 |
data ShutdownException = |
369 |
ShutdownException |
|
4959 | 370 |
deriving (Show, Typeable) |
371 |
||
372 |
instance Exception ShutdownException |
|
4996
76ef3d8bd78e
Fix crash (accessing already deleted client record) by reverting to old client removing handling + throwTo
unc0rr
parents:
4989
diff
changeset
|
373 |
|
5000
72d8fb26223d
- Don't pretend client sent some message from sending thread (fixes crash when client is already deleted by recieveng thread)
unc0rr
parents:
4996
diff
changeset
|
374 |
data ShutdownThreadException = ShutdownThreadException String |
72d8fb26223d
- Don't pretend client sent some message from sending thread (fixes crash when client is already deleted by recieveng thread)
unc0rr
parents:
4996
diff
changeset
|
375 |
deriving Typeable |
4996
76ef3d8bd78e
Fix crash (accessing already deleted client record) by reverting to old client removing handling + throwTo
unc0rr
parents:
4989
diff
changeset
|
376 |
|
5000
72d8fb26223d
- Don't pretend client sent some message from sending thread (fixes crash when client is already deleted by recieveng thread)
unc0rr
parents:
4996
diff
changeset
|
377 |
instance Show ShutdownThreadException where |
5001 | 378 |
show (ShutdownThreadException s) = s |
4996
76ef3d8bd78e
Fix crash (accessing already deleted client record) by reverting to old client removing handling + throwTo
unc0rr
parents:
4989
diff
changeset
|
379 |
instance Exception ShutdownThreadException |
5006 | 380 |
|
381 |
data BanInfo = |
|
5007 | 382 |
BanByIP B.ByteString B.ByteString UTCTime |
383 |
| BanByNick B.ByteString B.ByteString UTCTime |
|
5006 | 384 |
deriving (Show, Read) |