diff options
-rw-r--r-- | src/Simple.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/Simple.hs b/src/Simple.hs index 68524a8..80856d3 100644 --- a/src/Simple.hs +++ b/src/Simple.hs | |||
@@ -1,4 +1,4 @@ | |||
1 | {-# LANGUAGE RecordWildCards, ApplicativeDo, FlexibleContexts #-} | 1 | {-# LANGUAGE RecordWildCards, ApplicativeDo, FlexibleContexts, ViewPatterns, OverloadedStrings #-} |
2 | 2 | ||
3 | module Main (main) where | 3 | module Main (main) where |
4 | 4 | ||
@@ -51,15 +51,16 @@ main = do | |||
51 | ] | 51 | ] |
52 | 52 | ||
53 | flip runReaderT sConfig $ do | 53 | flip runReaderT sConfig $ do |
54 | mailStr <- liftIO getContents | 54 | mailStr <- liftIO Lazy.BS.getContents |
55 | delay <- scan mailStr | 55 | delay <- scan $ Lazy.Char8.BS.unpack mailStr |
56 | let | 56 | let |
57 | (headers, body) = break (== "") $ lines mailStr | 57 | (headers, body) = break (== "") $ Lazy.Char8.BS.lines mailStr |
58 | mailStr' = unlines $ filter (not . (isPrefixOf `on` CI.foldCase) "X-Delay:") headers ++ body | 58 | headers' = filter (not . (Lazy.Char8.BS.isPrefixOf `on` CI.foldCase) "X-Delay:") headers |
59 | mailStr' = Lazy.Char8.BS.unlines $ headers' ++ body | ||
59 | 60 | ||
60 | sendNow = sendmail sender recipients $ Lazy.Char8.BS.pack mailStr' | 61 | sendNow = sendmail sender recipients mailStr' |
61 | sendLater sendDelay = pushStore . yield $ StoredMail | 62 | sendLater sendDelay = pushStore . yield $ StoredMail |
62 | { message = Lazy.Char8.BS.pack mailStr' | 63 | { message = mailStr' |
63 | , .. | 64 | , .. |
64 | } | 65 | } |
65 | maybe sendNow sendLater delay | 66 | maybe sendNow sendLater delay |