gameServer/Utils.hs
changeset 10062 8ef80bd0402f
parent 10059 015ed10e7e66
child 10063 52e293f14977
equal deleted inserted replaced
10061:b7161f00a6ca 10062:8ef80bd0402f
    56             t : replaceTeam tm ts
    56             t : replaceTeam tm ts
    57 
    57 
    58 illegalName :: B.ByteString -> Bool
    58 illegalName :: B.ByteString -> Bool
    59 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
    59 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
    60     where
    60     where
    61         isIllegalChar c = c `List.elem` ("$()*+?[]^{|}" ++ ['\x00'..'\x1F'] ++ ['\x7F'..'\x9F'])
    61         isIllegalChar c = c `List.elem` ("$()*+?[]^{|}\x7F" ++ ['\x00'..'\x1F'])
    62 
    62 
    63 protoNumber2ver :: Word16 -> B.ByteString
    63 protoNumber2ver :: Word16 -> B.ByteString
    64 protoNumber2ver v = Map.findWithDefault "Unknown" v vermap
    64 protoNumber2ver v = Map.findWithDefault "Unknown" v vermap
    65     where
    65     where
    66         vermap = Map.fromList [
    66         vermap = Map.fromList [