gameServer/Utils.hs
changeset 13084 81c154fd4380
parent 12839 148c9524f38d
child 13308 e3613c0d3600
equal deleted inserted replaced
13083:dd904dd9c587 13084:81c154fd4380
    70         if teamname tm == teamname t then
    70         if teamname tm == teamname t then
    71             tm : ts
    71             tm : ts
    72         else
    72         else
    73             t : replaceTeam tm ts
    73             t : replaceTeam tm ts
    74 
    74 
       
    75 -- NOTE: Don't forget to update the error messages when you change the naming rules!
    75 illegalName :: B.ByteString -> Bool
    76 illegalName :: B.ByteString -> Bool
    76 illegalName b = B.null b || length s > 40 || all isSpace s || isSpace (head s) || isSpace (last s) || any isIllegalChar s
    77 illegalName b = B.null b || length s > 40 || all isSpace s || isSpace (head s) || isSpace (last s) || any isIllegalChar s
    77     where
    78     where
    78         s = UTF8.toString b
    79         s = UTF8.toString b
    79         isIllegalChar c = c `List.elem` ("$()*+?[]^{|}\x7F" ++ ['\x00'..'\x1F'])
    80         isIllegalChar c = c `List.elem` ("$()*+?[]^{|}\x7F" ++ ['\x00'..'\x1F'])