Apply new nick restrictions in server rewrite too server_refactor
authorunc0rr
Mon, 24 Jan 2011 21:32:26 +0300
branchserver_refactor
changeset 4581 af2e231bd9be
parent 4579 4e61c2a42121
child 4583 ab82045ea083
Apply new nick restrictions in server rewrite too
gameServer/Utils.hs
--- a/gameServer/Utils.hs	Mon Jan 10 18:57:44 2011 +0300
+++ b/gameServer/Utils.hs	Mon Jan 24 21:32:26 2011 +0300
@@ -77,7 +77,9 @@
             t : replaceTeam team teams
 
 illegalName :: B.ByteString -> Bool
-illegalName = all isSpace . B.unpack
+illegalName b = null s || all isSpace s || isSpace (head s) || isSpace (last s)
+    where
+        s = B.unpack b
 
 protoNumber2ver :: Word16 -> B.ByteString
 protoNumber2ver v = Map.findWithDefault "Unknown" v vermap