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