- Remove not needed Show instances
authorunc0rr
Sun, 13 Mar 2011 15:20:07 +0300
changeset 5006 6913d677c891
parent 5005 d7bddb280f4f
child 5007 c401891fe5e0
- Remove not needed Show instances - Introduce BanInfo data type
gameServer/CoreTypes.hs
--- a/gameServer/CoreTypes.hs	Sun Mar 13 15:09:29 2011 +0300
+++ b/gameServer/CoreTypes.hs	Sun Mar 13 15:20:07 2011 +0300
@@ -39,9 +39,6 @@
         teamsInGame :: Word
     }
 
-instance Show ClientInfo where
-    show ci = " nick: " ++ unpack (nick ci) ++ " host: " ++ unpack (host ci)
-
 instance Eq ClientInfo where
     (==) = (==) `on` clientSocket
 
@@ -64,11 +61,6 @@
         hedgehogs :: [HedgehogInfo]
     }
 
-instance Show TeamInfo where
-    show ti = "owner: " ++ unpack (teamowner ti)
-            ++ "name: " ++ unpack (teamname ti)
-            ++ "color: " ++ unpack (teamcolor ti)
-
 data RoomInfo =
     RoomInfo
     {
@@ -89,11 +81,6 @@
         params :: Map.Map B.ByteString [B.ByteString]
     }
 
-instance Show RoomInfo where
-    show ri = ", players: " ++ show (playersIn ri)
-            ++ ", ready: " ++ show (readyPlayers ri)
-            ++ ", teams: " ++ show (teams ri)
-
 newRoom :: RoomInfo
 newRoom =
     RoomInfo
@@ -145,8 +132,6 @@
         serverConfig :: Maybe Conf
     }
 
-instance Show ServerInfo where
-    show _ = "Server Info"
 
 newServerInfo :: Chan CoreMessage -> Chan DBQuery -> Maybe Conf -> ServerInfo
 newServerInfo =
@@ -184,13 +169,6 @@
     | TimerAction Int
     | Remove ClientIndex
 
-instance Show CoreMessage where
-    show (Accept _) = "Accept"
-    show (ClientMessage _) = "ClientMessage"
-    show (ClientAccountInfo {}) = "ClientAccountInfo"
-    show (TimerAction _) = "TimerAction"
-    show (Remove _) = "Remove"
-
 type MRnC = MRoomsAndClients RoomInfo ClientInfo
 type IRnC = IRoomsAndClients RoomInfo ClientInfo
 
@@ -212,3 +190,8 @@
 instance Show ShutdownThreadException where
     show (ShutdownThreadException s) = s
 instance Exception ShutdownThreadException
+
+data BanInfo =
+    BanByIP String UTCTime
+    | BanByNickname String UTCTime
+    deriving (Show, Read)