gameServer/Utils.hs
changeset 14064 12bfae554de5
parent 13673 1aa5e884326a
child 14287 9f0d81213d65
equal deleted inserted replaced
14063:b8df809c62bf 14064:12bfae554de5
    77 -- NOTE: Don't forget to update the error messages when you change the naming rules!
    77 -- NOTE: Don't forget to update the error messages when you change the naming rules!
    78 illegalName :: B.ByteString -> Bool
    78 illegalName :: B.ByteString -> Bool
    79 illegalName b = B.null b || length s > 40 || all isSpace s || isSpace (head s) || isSpace (last s) || any isIllegalChar s
    79 illegalName b = B.null b || length s > 40 || all isSpace s || isSpace (head s) || isSpace (last s) || any isIllegalChar s
    80     where
    80     where
    81         s = UTF8.toString b
    81         s = UTF8.toString b
    82         isIllegalChar c = c `List.elem` ("$()*+?[]^{|}\x7F" ++ ['\x00'..'\x1F'])
    82         isIllegalChar c = c `List.elem` ("$()*+?[]^{|}\x7F" ++ ['\x00'..'\x1F'] ++ ['\xFFF0'..'\xFFFF'])
    83 
    83 
    84 protoNumber2ver :: Word16 -> B.ByteString
    84 protoNumber2ver :: Word16 -> B.ByteString
    85 protoNumber2ver v = Map.findWithDefault "Unknown" v vermap
    85 protoNumber2ver v = Map.findWithDefault "Unknown" v vermap
    86     where
    86     where
    87         vermap = Map.fromList [
    87         vermap = Map.fromList [