diff options
author | tv <tv@shackspace.de> | 2015-03-08 10:45:52 +0100 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-03-08 10:45:52 +0100 |
commit | 74f1d114945f5bc384e5690f60f539e2d32d27d1 (patch) | |
tree | bd12197902a7f6ef5b2510519c779907a20ab7ab | |
parent | 9ba0916f1648eb62a5d2f2434761b396e931baca (diff) |
test5: replace Date header with State.now
-rw-r--r-- | test5.hs | 28 |
1 files changed, 13 insertions, 15 deletions
@@ -531,7 +531,7 @@ attachFilesToDraft q@State{..} = case getMessage (Z.label cursor) of ] >>= attachFiles filenames >>= return . removeHeader "Date" - >>= addDateHeader + >>= return . addDateHeader now >>= M.renderMail' >>= Notmuch.notmuchWithInput [ "insert" @@ -602,7 +602,7 @@ replyToAll q@State{..} = case getMessage (Z.label cursor) of -- else abort draft <- M.renderMail' =<< - addDateHeader =<< + return . addDateHeader now =<< return . readMail =<< T.readFile path -- TODO use TagOps @@ -772,19 +772,17 @@ withTempFile' s f = do withTempFile tmpdir (logname ++ "_much_" ++ s) f -addDateHeader :: M.Mail -> IO M.Mail -addDateHeader m@M.Mail{..} = do - t <- getCurrentTime - return m - { M.mailHeaders = - ( "Date" - , T.pack $ - formatTime defaultTimeLocale - rfc822DateFormat - t - ) : - mailHeaders - } +addDateHeader :: UTCTime -> M.Mail -> M.Mail +addDateHeader t m@M.Mail{..} = do + m { M.mailHeaders = + ( "Date" + , T.pack $ + formatTime defaultTimeLocale + rfc822DateFormat + t + ) : + mailHeaders + } removeHeader :: CI BS.ByteString -> M.Mail -> M.Mail removeHeader h m@M.Mail{..} = |