Set limit of messages at 2000 characters

This commit is contained in:
Phuntsok Drak-pa 2018-03-22 00:10:32 +01:00
parent cea07a8e19
commit de2523b083

View File

@ -79,6 +79,14 @@ fn write_to_server(stream: TcpStream) {
writer.flush().unwrap();
}
line => {
if line.len() > 2000 {
println!(
"{}",
"Cannot send a message longer than 2000 characters"
.bright_red()
);
continue;
}
writeln!(writer, "MSG {}", line).unwrap();
writer.flush().unwrap();
}