gameServer/Utils.hs
branchios-develop
changeset 13413 ba39a1d396c0
parent 13303 e3613c0d3600
child 13418 bb24c3414b0d
equal deleted inserted replaced
13411:6e8b807bda4b 13413:ba39a1d396c0
    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'])
   116             , (50, "0.9.22-dev")
   117             , (50, "0.9.22-dev")
   117             , (51, "0.9.22")
   118             , (51, "0.9.22")
   118             , (52, "0.9.23-dev")
   119             , (52, "0.9.23-dev")
   119             , (53, "0.9.23")
   120             , (53, "0.9.23")
   120             , (54, "0.9.24-dev")
   121             , (54, "0.9.24-dev")
       
   122             , (55, "0.9.24")
       
   123             , (56, "0.9.25-dev")
   121             ]
   124             ]
   122 
   125 
   123 askFromConsole :: B.ByteString -> IO B.ByteString
   126 askFromConsole :: B.ByteString -> IO B.ByteString
   124 askFromConsole msg = do
   127 askFromConsole msg = do
   125     B.putStr msg
   128     B.putStr msg