author | alfadur |
Thu, 21 Jun 2018 17:23:10 -0400 | |
changeset 13419 | 81e0ed105f5d |
parent 13416 | cdf69667593b |
child 13422 | 5fb27f94fc3b |
permissions | -rw-r--r-- |
12130 | 1 |
use server::coretypes::{ServerVar, GameCfg, TeamInfo, HedgehogInfo}; |
12131 | 2 |
use std; |
3 |
use std::ops; |
|
4 |
use std::convert::From; |
|
12130 | 5 |
|
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
6 |
#[derive(PartialEq, Eq, Clone, Debug)] |
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
7 |
pub enum HWProtocolMessage { |
12130 | 8 |
// core |
9 |
Ping, |
|
10 |
Pong, |
|
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
11 |
Quit(Option<String>), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
12 |
//Cmd(String, Vec<String>), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
13 |
Global(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
14 |
Watch(String), |
12130 | 15 |
ToggleServerRegisteredOnly, |
16 |
SuperPower, |
|
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
17 |
Info(String), |
12130 | 18 |
// not entered state |
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
19 |
Nick(String), |
12130 | 20 |
Proto(u32), |
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
21 |
Password(String, String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
22 |
Checker(u32, String, String), |
12130 | 23 |
// lobby |
24 |
List, |
|
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
25 |
Chat(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
26 |
CreateRoom(String, Option<String>), |
13416 | 27 |
JoinRoom(String, Option<String>), |
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
28 |
Follow(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
29 |
Rnd(Vec<String>), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
30 |
Kick(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
31 |
Ban(String, String, u32), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
32 |
BanIP(String, String, u32), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
33 |
BanNick(String, String, u32), |
12130 | 34 |
BanList, |
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
35 |
Unban(String), |
12130 | 36 |
SetServerVar(ServerVar), |
37 |
GetServerVar, |
|
38 |
RestartServer, |
|
39 |
Stats, |
|
40 |
// in room |
|
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
41 |
Part(Option<String>), |
12130 | 42 |
Cfg(GameCfg), |
43 |
AddTeam(TeamInfo), |
|
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
44 |
RemoveTeam(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
45 |
SetHedgehogsNumber(String, u8), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
46 |
SetTeamColor(String, u8), |
12130 | 47 |
ToggleReady, |
48 |
StartGame, |
|
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
49 |
EngineMessage(String), |
12130 | 50 |
RoundFinished, |
51 |
ToggleRestrictJoin, |
|
52 |
ToggleRestrictTeams, |
|
53 |
ToggleRegisteredOnly, |
|
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
54 |
RoomName(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
55 |
Delegate(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
56 |
TeamChat(String), |
12130 | 57 |
MaxTeams(u8), |
58 |
Fix, |
|
59 |
Unfix, |
|
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
60 |
Greeting(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
61 |
CallVote(Option<(String, Option<String>)>), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
62 |
Vote(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
63 |
ForceVote(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
64 |
Save(String, String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
65 |
Delete(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
66 |
SaveRoom(String), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
67 |
LoadRoom(String), |
12137
193dfdcb0620
- Use logging facilities instead of plain println!
unc0rr
parents:
12136
diff
changeset
|
68 |
Malformed, |
193dfdcb0620
- Use logging facilities instead of plain println!
unc0rr
parents:
12136
diff
changeset
|
69 |
Empty, |
12130 | 70 |
} |
12131 | 71 |
|
13416 | 72 |
#[derive(Debug)] |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
73 |
pub enum HWServerMessage { |
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
74 |
Ping, |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
75 |
Pong, |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
76 |
Bye(String), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
77 |
Nick(String), |
13416 | 78 |
Proto(u32), |
79 |
LobbyLeft(String, String), |
|
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
80 |
LobbyJoined(Vec<String>), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
81 |
ChatMsg(String, String), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
82 |
ClientFlags(String, Vec<String>), |
13416 | 83 |
Rooms(Vec<String>), |
84 |
RoomAdd(Vec<String>), |
|
85 |
RoomJoined(Vec<String>), |
|
86 |
RoomLeft(String, String), |
|
87 |
RoomRemove(String), |
|
88 |
RoomUpdated(String, Vec<String>), |
|
13419 | 89 |
TeamAdd(Vec<String>), |
90 |
TeamRemove(String), |
|
91 |
TeamAccepted(String), |
|
92 |
TeamColor(String, u8), |
|
93 |
HedgehogsNumber(String, u8), |
|
94 |
||
13416 | 95 |
ServerMessage(String), |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
96 |
Warning(String), |
13416 | 97 |
Error(String), |
12142
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
98 |
Connected(u32), |
4d7d41be1993
Start refactoring path from getting message from client to reacting to it
unc0rr
parents:
12141
diff
changeset
|
99 |
Unreachable, |
12131 | 100 |
} |
12136 | 101 |
|
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
102 |
impl<'a> HWProtocolMessage { |
12136 | 103 |
pub fn to_raw_protocol(&self) -> String { |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
104 |
use self::HWProtocolMessage::*; |
13416 | 105 |
match self { |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
106 |
Ping => "PING\n\n".to_string(), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
107 |
Pong => "PONG\n\n".to_string(), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
108 |
Quit(None) => format!("QUIT\n\n"), |
13416 | 109 |
Quit(Some(msg)) => format!("QUIT\n{}\n\n", msg), |
110 |
Global(msg) => format!("CMD\nGLOBAL\n{}\n\n", msg), |
|
111 |
Watch(name) => format!("CMD\nWATCH\n{}\n\n", name), |
|
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
112 |
ToggleServerRegisteredOnly => "CMD\nREGISTERED_ONLY\n\n".to_string(), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
113 |
SuperPower => "CMD\nSUPER_POWER\n\n".to_string(), |
13416 | 114 |
Info(info) => format!("CMD\nINFO\n{}\n\n", info), |
115 |
Nick(nick) => format!("NICK\n{}\n\n", nick), |
|
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
116 |
Proto(version) => format!("PROTO\n{}\n\n", version), |
13416 | 117 |
Password(p, s) => format!("PASSWORD\n{}\n{}\n\n", p, s), //? |
118 |
Checker(i, n, p) => |
|
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
119 |
format!("CHECKER\n{}\n{}\n{}\n\n", i, n, p), //?, |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
120 |
List => "LIST\n\n".to_string(), |
13416 | 121 |
Chat(msg) => format!("CHAT\n{}\n\n", msg), |
122 |
CreateRoom(name, None) => |
|
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
123 |
format!("CREATE_ROOM\n{}\n\n", name), |
13416 | 124 |
CreateRoom(name, Some(password)) => |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
125 |
format!("CREATE_ROOM\n{}\n{}\n\n", name, password), |
13416 | 126 |
JoinRoom(name, None) => |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
127 |
format!("JOIN\n{}\n\n", name), |
13416 | 128 |
JoinRoom(name, Some(arg)) => |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
129 |
format!("JOIN\n{}\n{}\n\n", name, arg), |
13416 | 130 |
Follow(name) => |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
131 |
format!("FOLLOW\n{}\n\n", name), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
132 |
//Rnd(Vec<String>), ??? |
13416 | 133 |
Kick(name) => format!("KICK\n{}\n\n", name), |
134 |
Ban(name, reason, time) => |
|
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
135 |
format!("BAN\n{}\n{}\n{}\n\n", name, reason, time), |
13416 | 136 |
BanIP(ip, reason, time) => |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
137 |
format!("BAN_IP\n{}\n{}\n{}\n\n", ip, reason, time), |
13416 | 138 |
BanNick(nick, reason, time) => |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
139 |
format!("BAN_NICK\n{}\n{}\n{}\n\n", nick, reason, time), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
140 |
BanList => "BANLIST\n\n".to_string(), |
13416 | 141 |
Unban(name) => format!("UNBAN\n{}\n\n", name), |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
142 |
//SetServerVar(ServerVar), ??? |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
143 |
GetServerVar => "GET_SERVER_VAR\n\n".to_string(), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
144 |
RestartServer => "CMD\nRESTART_SERVER\nYES\n\n".to_string(), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
145 |
Stats => "CMD\nSTATS\n\n".to_string(), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
146 |
Part(None) => "CMD\nPART\n\n".to_string(), |
13416 | 147 |
Part(Some(msg)) => format!("CMD\nPART\n{}\n\n", msg), |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
148 |
//Cfg(GameCfg) ?? |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
149 |
//AddTeam(TeamInfo) ??, |
13416 | 150 |
RemoveTeam(name) => format!("REMOVE_TEAM\n{}\n\n", name), |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
151 |
//SetHedgehogsNumber(String, u8), ?? |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
152 |
//SetTeamColor(String, u8), ?? |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
153 |
ToggleReady => "TOGGLE_READY\n\n".to_string(), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
154 |
StartGame => "START_GAME\n\n".to_string(), |
13416 | 155 |
EngineMessage(msg) => format!("EM\n{}\n\n", msg), |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
156 |
RoundFinished => "ROUNDFINISHED\n\n".to_string(), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
157 |
ToggleRestrictJoin => "TOGGLE_RESTRICT_JOINS\n\n".to_string(), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
158 |
ToggleRestrictTeams => "TOGGLE_RESTRICT_TEAMS\n\n".to_string(), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
159 |
ToggleRegisteredOnly => "TOGGLE_REGISTERED_ONLY\n\n".to_string(), |
13416 | 160 |
RoomName(name) => format!("ROOM_NAME\n{}\n\n", name), |
161 |
Delegate(name) => format!("CMD\nDELEGATE\n{}\n\n", name), |
|
162 |
TeamChat(msg) => format!("TEAMCHAT\n{}\n\n", msg), |
|
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
163 |
MaxTeams(count) => format!("CMD\nMAXTEAMS\n{}\n\n", count) , |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
164 |
Fix => "CMD\nFIX\n\n".to_string(), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
165 |
Unfix => "CMD\nUNFIX\n\n".to_string(), |
13416 | 166 |
Greeting(msg) => format!("CMD\nGREETING\n{}\n\n", msg), |
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
167 |
//CallVote(Option<(String, Option<String>)>) =>, ?? |
13416 | 168 |
Vote(msg) => format!("CMD\nVOTE\n{}\n\n", msg), |
169 |
ForceVote(msg) => format!("CMD\nFORCE\n{}\n\n", msg), |
|
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
170 |
//Save(String, String), ?? |
13416 | 171 |
Delete(room) => format!("CMD\nDELETE\n{}\n\n", room), |
172 |
SaveRoom(room) => format!("CMD\nSAVEROOM\n{}\n\n", room), |
|
173 |
LoadRoom(room) => format!("CMD\nLOADROOM\n{}\n\n", room), |
|
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
174 |
Malformed => "A\nQUICK\nBROWN\nHOG\nJUMPS\nOVER\nTHE\nLAZY\nDOG\n\n".to_string(), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
175 |
Empty => "\n\n".to_string(), |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
176 |
_ => panic!("Protocol message not yet implemented") |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
177 |
} |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
178 |
} |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
179 |
} |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
180 |
|
13416 | 181 |
macro_rules! const_braces { |
182 |
($e: expr) => { "{}\n" } |
|
183 |
} |
|
184 |
||
185 |
macro_rules! msg { |
|
186 |
[$($part: expr),*] => { |
|
187 |
format!(concat!($(const_braces!($part)),*, "\n"), $($part),*); |
|
188 |
}; |
|
189 |
} |
|
190 |
||
13419 | 191 |
fn construct_message(header: &[&str], msg: &Vec<String>) -> String { |
192 |
let mut v: Vec<_> = header.iter().map(|s| *s).collect(); |
|
193 |
v.extend(msg.iter().map(|s| &s[..])); |
|
194 |
v.push("\n"); |
|
195 |
v.join("\n") |
|
13416 | 196 |
} |
197 |
||
13119
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
198 |
impl HWServerMessage { |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
199 |
pub fn to_raw_protocol(&self) -> String { |
1e39b8749072
separated the server logic from all the async io mess.
alfadur
parents:
12147
diff
changeset
|
200 |
use self::HWServerMessage::*; |
12136 | 201 |
match self { |
13416 | 202 |
Ping => msg!["PING"], |
203 |
Pong => msg!["PONG"], |
|
204 |
Connected(protocol_version) => msg![ |
|
205 |
"CONNECTED", |
|
206 |
"Hedgewars server http://www.hedgewars.org/", |
|
207 |
protocol_version], |
|
208 |
Bye(msg) => msg!["BYE", msg], |
|
209 |
Nick(nick) => msg!["NICK", nick], |
|
210 |
Proto(proto) => msg!["PROTO", proto], |
|
211 |
LobbyLeft(nick, msg) => msg!["LOBBY:LEFT", nick, msg], |
|
13419 | 212 |
LobbyJoined(nicks) => |
213 |
construct_message(&["LOBBY:JOINED"], &nicks), |
|
214 |
ClientFlags(flags, nicks) => |
|
215 |
construct_message(&["CLIENT_FLAGS", flags], &nicks), |
|
216 |
Rooms(info) => |
|
217 |
construct_message(&["ROOMS"], &info), |
|
218 |
RoomAdd(info) => |
|
219 |
construct_message(&["ROOM", "ADD"], &info), |
|
220 |
RoomJoined(nicks) => |
|
221 |
construct_message(&["JOINED"], &nicks), |
|
13416 | 222 |
RoomLeft(nick, msg) => msg!["LEFT", nick, msg], |
223 |
RoomRemove(name) => msg!["ROOM", "DEL", name], |
|
13419 | 224 |
RoomUpdated(name, info) => |
225 |
construct_message(&["ROOM", "UPD", name], &info), |
|
226 |
TeamAdd(info) => |
|
227 |
construct_message(&["ADD_TEAM"], &info), |
|
228 |
TeamRemove(name) => msg!["REMOVE_TEAM", name], |
|
229 |
TeamAccepted(name) => msg!["TEAM_ACCEPTED", name], |
|
230 |
TeamColor(name, color) => msg!["TEAM_COLOR", name, color], |
|
231 |
HedgehogsNumber(name, number) => msg!["HH_NUM", name, number], |
|
13416 | 232 |
ChatMsg(nick, msg) => msg!["CHAT", nick, msg], |
233 |
ServerMessage(msg) => msg!["SERVER_MESSAGE", msg], |
|
234 |
Warning(msg) => msg!["WARNING", msg], |
|
235 |
Error(msg) => msg!["ERROR", msg], |
|
236 |
_ => msg!["ERROR", "UNIMPLEMENTED"], |
|
12136 | 237 |
} |
238 |
} |
|
239 |
} |