equal
deleted
inserted
replaced
18 ----------------------------- |
18 ----------------------------- |
19 import CoreTypes |
19 import CoreTypes |
20 import Utils |
20 import Utils |
21 import ClientIO |
21 import ClientIO |
22 import ServerState |
22 import ServerState |
|
23 import Consts |
23 |
24 |
24 data Action = |
25 data Action = |
25 AnswerClients ![ClientChan] ![B.ByteString] |
26 AnswerClients ![ClientChan] ![B.ByteString] |
26 | SendServerMessage |
27 | SendServerMessage |
27 | SendServerVars |
28 | SendServerVars |
379 infoM "Clients" (show ci ++ ": New client. Time: " ++ show (connectTime cl)) |
380 infoM "Clients" (show ci ++ ": New client. Time: " ++ show (connectTime cl)) |
380 |
381 |
381 return ci |
382 return ci |
382 |
383 |
383 modify (\s -> s{clientIndex = Just newClId}) |
384 modify (\s -> s{clientIndex = Just newClId}) |
384 processAction $ AnswerClients [sendChan cl] ["CONNECTED", "Hedgewars server http://www.hedgewars.org/"] |
385 processAction $ AnswerClients [sendChan cl] ["CONNECTED", "Hedgewars server http://www.hedgewars.org/", serverVersion] |
385 |
386 |
386 let newLogins = takeWhile (\(_ , (time, _)) -> connectTime cl `diffUTCTime` time <= 0) $ lastLogins si |
387 let newLogins = takeWhile (\(_ , (time, _)) -> connectTime cl `diffUTCTime` time <= 0) $ lastLogins si |
387 let info = host cl `Prelude.lookup` newLogins |
388 let info = host cl `Prelude.lookup` newLogins |
388 if isJust info then |
389 if isJust info then |
389 mapM_ processAction [ModifyServerInfo (\s -> s{lastLogins = newLogins}), ByeClient (snd . fromJust $ info)] |
390 mapM_ processAction [ModifyServerInfo (\s -> s{lastLogins = newLogins}), ByeClient (snd . fromJust $ info)] |