gameServer/Utils.hs
changeset 8396 5123eac2f9d6
parent 7862 bd76ca40db68
child 8401 87410ae372f6
equal deleted inserted replaced
8395:0b357c57e01c 8396:5123eac2f9d6
   116 
   116 
   117 cutHost :: B.ByteString -> B.ByteString
   117 cutHost :: B.ByteString -> B.ByteString
   118 cutHost = B.intercalate "." .  flip (++) ["*","*"] . List.take 2 . B.split '.'
   118 cutHost = B.intercalate "." .  flip (++) ["*","*"] . List.take 2 . B.split '.'
   119 
   119 
   120 caseInsensitiveCompare :: B.ByteString -> B.ByteString -> Bool
   120 caseInsensitiveCompare :: B.ByteString -> B.ByteString -> Bool
   121 caseInsensitiveCompare a b = f a == f b
   121 caseInsensitiveCompare a b = upperCase a == upperCase b
   122     where
       
   123         f = map Char.toUpper . UTF8.toString
       
   124 
   122 
       
   123 upperCase :: B.ByteString -> B.ByteString
       
   124 upperCase = UTF8.fromString . map Char.toUpper . UTF8.toString
   125 
   125 
   126 roomInfo :: B.ByteString -> RoomInfo -> [B.ByteString]
   126 roomInfo :: B.ByteString -> RoomInfo -> [B.ByteString]
   127 roomInfo n r = [
   127 roomInfo n r = [
   128         showB $ isJust $ gameInfo r,
   128         showB $ isJust $ gameInfo r,
   129         name r,
   129         name r,