equal
deleted
inserted
replaced
52 | CheckFailed B.ByteString |
52 | CheckFailed B.ByteString |
53 | CheckSuccess [B.ByteString] |
53 | CheckSuccess [B.ByteString] |
54 deriving Show |
54 deriving Show |
55 |
55 |
56 serverAddress = "netserver.hedgewars.org" |
56 serverAddress = "netserver.hedgewars.org" |
57 protocolNumber = "55" |
57 protocolNumber = "59" |
58 |
58 |
59 getLines :: Handle -> IO [B.ByteString] |
59 getLines :: Handle -> IO [B.ByteString] |
60 getLines h = g |
60 getLines h = g |
61 where |
61 where |
62 g = do |
62 g = do |
173 onPacket _ ["LOGONPASSED"] = answer ["READY"] |
173 onPacket _ ["LOGONPASSED"] = answer ["READY"] |
174 onPacket chan ("REPLAY":msgs) = do |
174 onPacket chan ("REPLAY":msgs) = do |
175 checkReplay home exe prefix chan msgs |
175 checkReplay home exe prefix chan msgs |
176 warningM "Check" "Started check" |
176 warningM "Check" "Started check" |
177 onPacket _ ("BYE" : xs) = error $ show xs |
177 onPacket _ ("BYE" : xs) = error $ show xs |
|
178 onPacket _ ("CHAT" : nickname : text) = infoM "Chat" $ ">>> " ++ show nickname ++ ": " ++ show text |
178 onPacket _ _ = return () |
179 onPacket _ _ = return () |
179 |
180 |
180 |
181 |
181 main :: IO () |
182 main :: IO () |
182 main = withSocketsDo . forever $ do |
183 main = withSocketsDo . forever $ do |
187 |
188 |
188 updateGlobalLogger "Core" (setLevel DEBUG) |
189 updateGlobalLogger "Core" (setLevel DEBUG) |
189 updateGlobalLogger "Network" (setLevel WARNING) |
190 updateGlobalLogger "Network" (setLevel WARNING) |
190 updateGlobalLogger "Check" (setLevel DEBUG) |
191 updateGlobalLogger "Check" (setLevel DEBUG) |
191 updateGlobalLogger "Engine" (setLevel DEBUG) |
192 updateGlobalLogger "Engine" (setLevel DEBUG) |
|
193 updateGlobalLogger "Chat" (setLevel DEBUG) |
192 |
194 |
193 d <- getHomeDirectory |
195 d <- getHomeDirectory |
194 Right (login, password) <- runErrorT $ do |
196 Right (login, password) <- runErrorT $ do |
195 conf <- join . liftIO . CF.readfile CF.emptyCP $ d ++ "/.hedgewars/settings.ini" |
197 conf <- join . liftIO . CF.readfile CF.emptyCP $ d ++ "/.hedgewars/settings.ini" |
196 l <- CF.get conf "net" "nick" |
198 l <- CF.get conf "net" "nick" |