gameServer/OfficialServer/GameReplayStore.hs
author Zorg <zorgiepoo@gmail.com>
Wed, 08 Jun 2011 03:36:54 -0400
changeset 5229 148d581b17ab
parent 5143 649d87819682
child 5996 2c72fe81dd37
permissions -rw-r--r--
Attempt to fix issue #125. The password pop-up doesn't appear every time when going into the official server anymore, now it only does it when the password is blank. If a user enters an invalid password, the password is set blank to avoid the user going back to the official server just to be rejected. When entering an invalid password, the unknown error dialog doesn't show up anymore, but the connection lost to server one still does. This fixes the bug where the user would be spammed with error messages. The user can also now change his password in the settings page.

{-# LANGUAGE ScopedTypeVariables #-}
module OfficialServer.GameReplayStore where

import CoreTypes
import Data.Time
import Control.Exception as E
import qualified Data.Map as Map
import Data.Sequence()
import System.Log.Logger

saveReplay :: RoomInfo -> IO ()
saveReplay r = do
    time <- getCurrentTime
    let fileName = "replays/" ++ show time
    let replayInfo = (teamsAtStart r, Map.toList $ mapParams r, Map.toList $ params r, roundMsgs r)
    E.catch
        (writeFile fileName (show replayInfo))
        (\(e :: IOException) -> warningM "REPLAYS" $ "Couldn't write to " ++ fileName ++ ": " ++ show e)