From e89946f0e51365969cb2097a4a31205806475f80 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 28 Aug 2022 23:58:14 +0200 Subject: properly render untweaked MIME messages --- src/main.hs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/main.hs') diff --git a/src/main.hs b/src/main.hs index bd2bc73..6c4b061 100644 --- a/src/main.hs +++ b/src/main.hs @@ -5,6 +5,7 @@ import qualified Data.Aeson import Data.Aeson.Encode.Pretty import qualified Data.ByteString.Lazy.Char8 import Data.MIME.Extended +import Data.MIME.Untweaked (toUntweaked) import qualified Options.Applicative import qualified System.Exit import System.IO (hPutStrLn,stderr) @@ -42,12 +43,6 @@ optionsParser = ) -newtype MIMENoTweak = MIMENoTweak MIME - -instance RenderMessage MIMENoTweak where - buildBody h (MIMENoTweak b) = buildBody h b - - main :: IO () main = do options <- @@ -71,8 +66,8 @@ main = do if optionDecode options then case Data.Aeson.decode s :: Maybe MIMEMessage of - Just (Message h b) -> - output $ renderMessage (Message h (MIMENoTweak b)) + Just m -> + output $ renderMessage (toUntweaked m) Nothing -> do hPutStrLn stderr "error: failed to decode MIME message" -- cgit v1.2.3