This commit is contained in:
qvalentin 2025-01-21 21:31:39 +01:00
parent 1a44dae580
commit a7ce816dc6
2 changed files with 5 additions and 2 deletions

View file

@ -46,5 +46,5 @@ broadCastToClientsGeneric message = do
broadcast :: Text -> ConnectedClients -> IO ()
broadcast message clients = do
putStrLn message
putStrLn $ "Broadcasting: " ++ message
forM_ clients $ \client -> WS.sendTextData (conn client) message

View file

@ -54,13 +54,16 @@ roomStateDiffers newData = do
not . eqIgnoreOrdering newData <$> getRoomDataState
roomStateDiffInOpenRooms ::
( MonadRoomDataStateRead m
( MonadRoomDataStateRead m,
MonadIO m
) =>
RoomsData ->
m (RoomsData, RoomsData)
roomStateDiffInOpenRooms newData = do
current <- getRoomDataState
liftIO $ putStrLn $ pack $ "Current rooms: " ++ show current
liftIO $ putStrLn $ pack $ "New rooms: " ++ show newData
let newRooms = filter roomNotEmpty $ filter (\newRoom -> isNothing $ find (sameName newRoom) current) newData
let oldRooms = filter roomNotEmpty $ filter (\oldRoom -> isNothing $ find (sameName oldRoom) newData) current