# HG changeset patch
# User unc0rr
# Date 1390499666 -14400
# Node ID 52e293f14977c554a321107dd3955f5d54c0a672
# Parent  8ef80bd0402fd1ef3c5d65efb2ec3619a960b0d5
Handle chars and not bytes for usernames :-p

diff -r 8ef80bd0402f -r 52e293f14977 gameServer/Utils.hs
--- a/gameServer/Utils.hs	Thu Jan 23 14:18:06 2014 +0100
+++ b/gameServer/Utils.hs	Thu Jan 23 21:54:26 2014 +0400
@@ -56,8 +56,9 @@
             t : replaceTeam tm ts
 
 illegalName :: B.ByteString -> Bool
-illegalName s = B.null s || B.length s > 40 || B.all isSpace s || isSpace (B.head s) || isSpace (B.last s) || B.any isIllegalChar s
+illegalName b = B.null b || length s > 40 || all isSpace s || isSpace (head s) || isSpace (last s) || any isIllegalChar s
     where
+        s = UTF8.toString b
         isIllegalChar c = c `List.elem` ("$()*+?[]^{|}\x7F" ++ ['\x00'..'\x1F'])
 
 protoNumber2ver :: Word16 -> B.ByteString