From 9f4e2644188f985d7cd806c13e2c0dee1688b9f0 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 29 Jan 2019 20:49:47 +0100 Subject: Reaktor: add send delay support --- src/Reaktor/Internal.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Reaktor') diff --git a/src/Reaktor/Internal.hs b/src/Reaktor/Internal.hs index 66e00af..bd3d241 100644 --- a/src/Reaktor/Internal.hs +++ b/src/Reaktor/Internal.hs @@ -32,11 +32,12 @@ data Config = Config , cNick :: Maybe Text , cLogHandle :: Handle , cLogTime :: Bool + , cSendDelay :: Maybe Int } deriving Show instance Default Config where - def = Config False "irc.r" "6667" Nothing stderr True + def = Config False "irc.r" "6667" Nothing stderr True Nothing instance FromJSON Config where parseJSON = \case @@ -47,6 +48,7 @@ instance FromJSON Config where cNick <- v .:? "nick" cLogHandle <- pure (cLogHandle def) cLogTime <- v .:? "logTime" .!= cLogTime def + cSendDelay <- fmap (round . (*(1e6 :: Float))) <$> v .:? "sendDelaySec" pure Config{..} invalid -> typeMismatch "Config" invalid where -- cgit v1.2.3