gameServer2/src/utils.rs
changeset 13421 cdf69667593b
parent 12142 193dfdcb0620
child 13428 87a6cad20c90
--- a/gameServer2/src/utils.rs	Thu Jun 14 16:44:27 2018 -0400
+++ b/gameServer2/src/utils.rs	Mon Jun 18 09:22:53 2018 -0400
@@ -2,3 +2,11 @@
 
 pub const PROTOCOL_VERSION : u32 = 3;
 pub const SERVER: mio::Token = mio::Token(1000000000 + 0);
+
+pub fn is_name_illegal(name: &str ) -> bool{
+    name.len() > 40 ||
+        name.trim().is_empty() ||
+        name.chars().any(|c|
+            "$()*+?[]^{|}\x7F".contains(c) ||
+                '\x00' <= c && c <= '\x1F')
+}
\ No newline at end of file