author | Wuzzy <Wuzzy2@mail.ru> |
Wed, 19 Dec 2018 05:50:02 +0100 | |
changeset 14480 | 2113296b7a29 |
parent 14462 | 98ef2913ec73 |
child 14702 | f64e21f164a5 |
permissions | -rw-r--r-- |
14462 | 1 |
use crate::server::coretypes::{GameCfg, HedgehogInfo, ServerVar, TeamInfo, VoteType}; |
2 |
use std::{convert::From, iter::once, ops}; |
|
12135 | 3 |
|
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
4 |
#[derive(PartialEq, Eq, Clone, Debug)] |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
5 |
pub enum HWProtocolMessage { |
12135 | 6 |
// core |
7 |
Ping, |
|
8 |
Pong, |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
9 |
Quit(Option<String>), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
10 |
//Cmd(String, Vec<String>), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
11 |
Global(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
12 |
Watch(String), |
12135 | 13 |
ToggleServerRegisteredOnly, |
14 |
SuperPower, |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
15 |
Info(String), |
12135 | 16 |
// not entered state |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
17 |
Nick(String), |
13525 | 18 |
Proto(u16), |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
19 |
Password(String, String), |
13803 | 20 |
Checker(u16, String, String), |
12135 | 21 |
// lobby |
22 |
List, |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
23 |
Chat(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
24 |
CreateRoom(String, Option<String>), |
13421 | 25 |
JoinRoom(String, Option<String>), |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
26 |
Follow(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
27 |
Rnd(Vec<String>), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
28 |
Kick(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
29 |
Ban(String, String, u32), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
30 |
BanIP(String, String, u32), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
31 |
BanNick(String, String, u32), |
12135 | 32 |
BanList, |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
33 |
Unban(String), |
12135 | 34 |
SetServerVar(ServerVar), |
35 |
GetServerVar, |
|
36 |
RestartServer, |
|
37 |
Stats, |
|
38 |
// in room |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
39 |
Part(Option<String>), |
12135 | 40 |
Cfg(GameCfg), |
13529 | 41 |
AddTeam(Box<TeamInfo>), |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
42 |
RemoveTeam(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
43 |
SetHedgehogsNumber(String, u8), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
44 |
SetTeamColor(String, u8), |
12135 | 45 |
ToggleReady, |
46 |
StartGame, |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
47 |
EngineMessage(String), |
12135 | 48 |
RoundFinished, |
49 |
ToggleRestrictJoin, |
|
50 |
ToggleRestrictTeams, |
|
51 |
ToggleRegisteredOnly, |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
52 |
RoomName(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
53 |
Delegate(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
54 |
TeamChat(String), |
12135 | 55 |
MaxTeams(u8), |
56 |
Fix, |
|
57 |
Unfix, |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
58 |
Greeting(String), |
13483 | 59 |
CallVote(Option<VoteType>), |
60 |
Vote(bool), |
|
61 |
ForceVote(bool), |
|
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
62 |
Save(String, String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
63 |
Delete(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
64 |
SaveRoom(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
65 |
LoadRoom(String), |
12142
193dfdcb0620
- Use logging facilities instead of plain println!
unc0rr
parents:
12141
diff
changeset
|
66 |
Malformed, |
193dfdcb0620
- Use logging facilities instead of plain println!
unc0rr
parents:
12141
diff
changeset
|
67 |
Empty, |
12135 | 68 |
} |
12136 | 69 |
|
13421 | 70 |
#[derive(Debug)] |
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
71 |
pub enum HWServerMessage { |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
72 |
Ping, |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
73 |
Pong, |
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
74 |
Bye(String), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
75 |
Nick(String), |
13525 | 76 |
Proto(u16), |
13805 | 77 |
ServerAuth(String), |
13421 | 78 |
LobbyLeft(String, String), |
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
79 |
LobbyJoined(Vec<String>), |
14462 | 80 |
ChatMsg { nick: String, msg: String }, |
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
81 |
ClientFlags(String, Vec<String>), |
13421 | 82 |
Rooms(Vec<String>), |
83 |
RoomAdd(Vec<String>), |
|
84 |
RoomJoined(Vec<String>), |
|
85 |
RoomLeft(String, String), |
|
86 |
RoomRemove(String), |
|
87 |
RoomUpdated(String, Vec<String>), |
|
13424 | 88 |
TeamAdd(Vec<String>), |
89 |
TeamRemove(String), |
|
90 |
TeamAccepted(String), |
|
91 |
TeamColor(String, u8), |
|
92 |
HedgehogsNumber(String, u8), |
|
13427 | 93 |
ConfigEntry(String, Vec<String>), |
13483 | 94 |
Kicked, |
13428 | 95 |
RunGame, |
13433 | 96 |
ForwardEngineMessage(Vec<String>), |
13428 | 97 |
RoundFinished, |
13424 | 98 |
|
13421 | 99 |
ServerMessage(String), |
13806 | 100 |
Notice(String), |
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
101 |
Warning(String), |
13421 | 102 |
Error(String), |
12147
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
103 |
Connected(u32), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12146
diff
changeset
|
104 |
Unreachable, |
13806 | 105 |
|
106 |
//Deprecated messages |
|
14462 | 107 |
LegacyReady(bool, Vec<String>), |
12136 | 108 |
} |
12141 | 109 |
|
14462 | 110 |
pub fn server_chat(msg: String) -> HWServerMessage { |
111 |
HWServerMessage::ChatMsg { |
|
112 |
nick: "[server]".to_string(), |
|
113 |
msg, |
|
114 |
} |
|
13483 | 115 |
} |
116 |
||
13427 | 117 |
impl GameCfg { |
13444 | 118 |
pub fn to_protocol(&self) -> (String, Vec<String>) { |
13671 | 119 |
use crate::server::coretypes::GameCfg::*; |
13427 | 120 |
match self { |
13444 | 121 |
FeatureSize(s) => ("FEATURE_SIZE".to_string(), vec![s.to_string()]), |
122 |
MapType(t) => ("MAP".to_string(), vec![t.to_string()]), |
|
123 |
MapGenerator(g) => ("MAPGEN".to_string(), vec![g.to_string()]), |
|
124 |
MazeSize(s) => ("MAZE_SIZE".to_string(), vec![s.to_string()]), |
|
125 |
Seed(s) => ("SEED".to_string(), vec![s.to_string()]), |
|
126 |
Template(t) => ("TEMPLATE".to_string(), vec![t.to_string()]), |
|
13427 | 127 |
|
13444 | 128 |
Ammo(n, None) => ("AMMO".to_string(), vec![n.to_string()]), |
129 |
Ammo(n, Some(s)) => ("AMMO".to_string(), vec![n.to_string(), s.to_string()]), |
|
13806 | 130 |
Scheme(n, s) if s.is_empty() => ("SCHEME".to_string(), vec![n.to_string()]), |
131 |
Scheme(n, s) => ("SCHEME".to_string(), { |
|
13427 | 132 |
let mut v = vec![n.to_string()]; |
13444 | 133 |
v.extend(s.clone().into_iter()); |
13427 | 134 |
v |
135 |
}), |
|
13444 | 136 |
Script(s) => ("SCRIPT".to_string(), vec![s.to_string()]), |
137 |
Theme(t) => ("THEME".to_string(), vec![t.to_string()]), |
|
14462 | 138 |
DrawnMap(m) => ("DRAWNMAP".to_string(), vec![m.to_string()]), |
13427 | 139 |
} |
140 |
} |
|
13444 | 141 |
|
142 |
pub fn to_server_msg(&self) -> HWServerMessage { |
|
143 |
use self::HWServerMessage::ConfigEntry; |
|
144 |
let (name, args) = self.to_protocol(); |
|
145 |
HWServerMessage::ConfigEntry(name, args) |
|
146 |
} |
|
13427 | 147 |
} |
148 |
||
13421 | 149 |
macro_rules! const_braces { |
14462 | 150 |
($e: expr) => { |
151 |
"{}\n" |
|
152 |
}; |
|
13421 | 153 |
} |
154 |
||
155 |
macro_rules! msg { |
|
156 |
[$($part: expr),*] => { |
|
157 |
format!(concat!($(const_braces!($part)),*, "\n"), $($part),*); |
|
158 |
}; |
|
159 |
} |
|
160 |
||
13801 | 161 |
#[cfg(test)] |
13444 | 162 |
macro_rules! several { |
163 |
[$part: expr] => { once($part) }; |
|
164 |
[$part: expr, $($other: expr),*] => { once($part).chain(several![$($other),*]) }; |
|
165 |
} |
|
166 |
||
13438
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
167 |
impl HWProtocolMessage { |
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
168 |
/** Converts the message to a raw `String`, which can be sent over the network. |
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
169 |
* |
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
170 |
* This is the inverse of the `message` parser. |
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
171 |
*/ |
13801 | 172 |
#[cfg(test)] |
13438
fb104e150878
Implement to_raw_protocol for Rnd and enable tests. Add cargo/rls build artifacts to .gitignore
Marcin Mielniczuk <marmistrz.dev@zoho.eu>
parents:
13437
diff
changeset
|
173 |
pub(crate) fn to_raw_protocol(&self) -> String { |
13437 | 174 |
use self::HWProtocolMessage::*; |
175 |
match self { |
|
176 |
Ping => msg!["PING"], |
|
177 |
Pong => msg!["PONG"], |
|
178 |
Quit(None) => msg!["QUIT"], |
|
179 |
Quit(Some(msg)) => msg!["QUIT", msg], |
|
180 |
Global(msg) => msg!["CMD", format!("GLOBAL {}", msg)], |
|
181 |
Watch(name) => msg!["CMD", format!("WATCH {}", name)], |
|
182 |
ToggleServerRegisteredOnly => msg!["CMD", "REGISTERED_ONLY"], |
|
14462 | 183 |
SuperPower => msg!["CMD", "SUPER_POWER"], |
13437 | 184 |
Info(info) => msg!["CMD", format!("INFO {}", info)], |
185 |
Nick(nick) => msg!("NICK", nick), |
|
186 |
Proto(version) => msg!["PROTO", version], |
|
187 |
Password(p, s) => msg!["PASSWORD", p, s], |
|
188 |
Checker(i, n, p) => msg!["CHECKER", i, n, p], |
|
189 |
List => msg!["LIST"], |
|
190 |
Chat(msg) => msg!["CHAT", msg], |
|
191 |
CreateRoom(name, None) => msg!["CREATE_ROOM", name], |
|
14462 | 192 |
CreateRoom(name, Some(password)) => msg!["CREATE_ROOM", name, password], |
13437 | 193 |
JoinRoom(name, None) => msg!["JOIN_ROOM", name], |
14462 | 194 |
JoinRoom(name, Some(password)) => msg!["JOIN_ROOM", name, password], |
13437 | 195 |
Follow(name) => msg!["FOLLOW", name], |
14462 | 196 |
Rnd(args) => { |
197 |
if args.is_empty() { |
|
198 |
msg!["CMD", "RND"] |
|
199 |
} else { |
|
200 |
msg!["CMD", format!("RND {}", args.join(" "))] |
|
201 |
} |
|
202 |
} |
|
13437 | 203 |
Kick(name) => msg!["KICK", name], |
204 |
Ban(name, reason, time) => msg!["BAN", name, reason, time], |
|
205 |
BanIP(ip, reason, time) => msg!["BAN_IP", ip, reason, time], |
|
14462 | 206 |
BanNick(nick, reason, time) => msg!("BAN_NICK", nick, reason, time), |
13437 | 207 |
BanList => msg!["BANLIST"], |
208 |
Unban(name) => msg!["UNBAN", name], |
|
209 |
//SetServerVar(ServerVar), ??? |
|
210 |
GetServerVar => msg!["GET_SERVER_VAR"], |
|
211 |
RestartServer => msg!["CMD", "RESTART_SERVER YES"], |
|
212 |
Stats => msg!["CMD", "STATS"], |
|
213 |
Part(None) => msg!["PART"], |
|
214 |
Part(Some(msg)) => msg!["PART", msg], |
|
13444 | 215 |
Cfg(config) => { |
216 |
let (name, args) = config.to_protocol(); |
|
217 |
msg!["CFG", name, args.join("\n")] |
|
14462 | 218 |
} |
219 |
AddTeam(info) => msg![ |
|
220 |
"ADD_TEAM", |
|
221 |
info.name, |
|
222 |
info.color, |
|
223 |
info.grave, |
|
224 |
info.fort, |
|
225 |
info.voice_pack, |
|
226 |
info.flag, |
|
227 |
info.difficulty, |
|
228 |
info.hedgehogs |
|
229 |
.iter() |
|
230 |
.flat_map(|h| several![&h.name[..], &h.hat[..]]) |
|
231 |
.collect::<Vec<_>>() |
|
232 |
.join("\n") |
|
233 |
], |
|
13437 | 234 |
RemoveTeam(name) => msg!["REMOVE_TEAM", name], |
13444 | 235 |
SetHedgehogsNumber(team, number) => msg!["HH_NUM", team, number], |
236 |
SetTeamColor(team, color) => msg!["TEAM_COLOR", team, color], |
|
13437 | 237 |
ToggleReady => msg!["TOGGLE_READY"], |
238 |
StartGame => msg!["START_GAME"], |
|
239 |
EngineMessage(msg) => msg!["EM", msg], |
|
240 |
RoundFinished => msg!["ROUNDFINISHED"], |
|
241 |
ToggleRestrictJoin => msg!["TOGGLE_RESTRICT_JOINS"], |
|
242 |
ToggleRestrictTeams => msg!["TOGGLE_RESTRICT_TEAMS"], |
|
243 |
ToggleRegisteredOnly => msg!["TOGGLE_REGISTERED_ONLY"], |
|
244 |
RoomName(name) => msg!["ROOM_NAME", name], |
|
245 |
Delegate(name) => msg!["CMD", format!("DELEGATE {}", name)], |
|
246 |
TeamChat(msg) => msg!["TEAMCHAT", msg], |
|
14462 | 247 |
MaxTeams(count) => msg!["CMD", format!("MAXTEAMS {}", count)], |
13437 | 248 |
Fix => msg!["CMD", "FIX"], |
249 |
Unfix => msg!["CMD", "UNFIX"], |
|
250 |
Greeting(msg) => msg!["CMD", format!("GREETING {}", msg)], |
|
251 |
//CallVote(Option<(String, Option<String>)>) =>, ?? |
|
14462 | 252 |
Vote(msg) => msg!["CMD", format!("VOTE {}", if *msg { "YES" } else { "NO" })], |
253 |
ForceVote(msg) => msg!["CMD", format!("FORCE {}", if *msg { "YES" } else { "NO" })], |
|
13533 | 254 |
Save(name, location) => msg!["CMD", format!("SAVE {} {}", name, location)], |
255 |
Delete(name) => msg!["CMD", format!("DELETE {}", name)], |
|
256 |
SaveRoom(name) => msg!["CMD", format!("SAVEROOM {}", name)], |
|
257 |
LoadRoom(name) => msg!["CMD", format!("LOADROOM {}", name)], |
|
13437 | 258 |
Malformed => msg!["A", "QUICK", "BROWN", "HOG", "JUMPS", "OVER", "THE", "LAZY", "DOG"], |
259 |
Empty => msg![""], |
|
14462 | 260 |
_ => panic!("Protocol message not yet implemented"), |
13437 | 261 |
} |
262 |
} |
|
263 |
} |
|
264 |
||
13529 | 265 |
fn construct_message(header: &[&str], msg: &[String]) -> String { |
14355 | 266 |
let mut v: Vec<_> = header.iter().cloned().collect(); |
13424 | 267 |
v.extend(msg.iter().map(|s| &s[..])); |
268 |
v.push("\n"); |
|
269 |
v.join("\n") |
|
13421 | 270 |
} |
271 |
||
13124
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
272 |
impl HWServerMessage { |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
273 |
pub fn to_raw_protocol(&self) -> String { |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12152
diff
changeset
|
274 |
use self::HWServerMessage::*; |
12141 | 275 |
match self { |
13421 | 276 |
Ping => msg!["PING"], |
277 |
Pong => msg!["PONG"], |
|
278 |
Connected(protocol_version) => msg![ |
|
279 |
"CONNECTED", |
|
13672 | 280 |
"Hedgewars server https://www.hedgewars.org/", |
14462 | 281 |
protocol_version |
282 |
], |
|
13421 | 283 |
Bye(msg) => msg!["BYE", msg], |
284 |
Nick(nick) => msg!["NICK", nick], |
|
285 |
Proto(proto) => msg!["PROTO", proto], |
|
13805 | 286 |
ServerAuth(hash) => msg!["SERVER_AUTH", hash], |
13421 | 287 |
LobbyLeft(nick, msg) => msg!["LOBBY:LEFT", nick, msg], |
14462 | 288 |
LobbyJoined(nicks) => construct_message(&["LOBBY:JOINED"], &nicks), |
289 |
ClientFlags(flags, nicks) => construct_message(&["CLIENT_FLAGS", flags], &nicks), |
|
290 |
Rooms(info) => construct_message(&["ROOMS"], &info), |
|
291 |
RoomAdd(info) => construct_message(&["ROOM", "ADD"], &info), |
|
292 |
RoomJoined(nicks) => construct_message(&["JOINED"], &nicks), |
|
13421 | 293 |
RoomLeft(nick, msg) => msg!["LEFT", nick, msg], |
294 |
RoomRemove(name) => msg!["ROOM", "DEL", name], |
|
14462 | 295 |
RoomUpdated(name, info) => construct_message(&["ROOM", "UPD", name], &info), |
296 |
TeamAdd(info) => construct_message(&["ADD_TEAM"], &info), |
|
13424 | 297 |
TeamRemove(name) => msg!["REMOVE_TEAM", name], |
298 |
TeamAccepted(name) => msg!["TEAM_ACCEPTED", name], |
|
299 |
TeamColor(name, color) => msg!["TEAM_COLOR", name, color], |
|
300 |
HedgehogsNumber(name, number) => msg!["HH_NUM", name, number], |
|
14462 | 301 |
ConfigEntry(name, values) => construct_message(&["CFG", name], &values), |
13483 | 302 |
Kicked => msg!["KICKED"], |
13428 | 303 |
RunGame => msg!["RUN_GAME"], |
14462 | 304 |
ForwardEngineMessage(em) => construct_message(&["EM"], &em), |
13428 | 305 |
RoundFinished => msg!["ROUND_FINISHED"], |
14462 | 306 |
ChatMsg { nick, msg } => msg!["CHAT", nick, msg], |
13421 | 307 |
ServerMessage(msg) => msg!["SERVER_MESSAGE", msg], |
13806 | 308 |
Notice(msg) => msg!["NOTICE", msg], |
13421 | 309 |
Warning(msg) => msg!["WARNING", msg], |
310 |
Error(msg) => msg!["ERROR", msg], |
|
13806 | 311 |
|
14462 | 312 |
LegacyReady(is_ready, nicks) => { |
313 |
construct_message(&[if *is_ready { "READY" } else { "NOT_READY" }], &nicks) |
|
314 |
} |
|
13806 | 315 |
|
13421 | 316 |
_ => msg!["ERROR", "UNIMPLEMENTED"], |
12141 | 317 |
} |
318 |
} |
|
319 |
} |