purebred-0.1.0.0: An mail user agent built around notmuch

Safe HaskellNone
LanguageHaskell2010

Storage.ParsedMail

Contents

Synopsis

Synopsis

This module integrates with an email parser in order to display all parts.

API

parseMail :: (MonadError Error m, MonadIO m) => NotmuchMail -> FilePath -> m MIMEMessage Source #

bodyToDisplay :: (MonadMask m, MonadError Error m, MonadIO m) => AppState -> Int -> CharsetLookup -> ContentType -> MIMEMessage -> m (MIMEMessage, MailBody) Source #

findMatchingWords :: Text -> MailBody -> MailBody Source #

Find matching words in the AST and change the annotation so they're highlighted during rendering

Note, that the matching is case sensitive.

removeMatchingWords :: MailBody -> MailBody Source #

Reset all matching words, effectively removing any information for highlights

makeScrollSteps :: MailBody -> [ScrollStep] Source #

Create a list of steps to record which absolute positions brick/the terminal should scroll.

Header data

getTo :: Message s a -> Text Source #

getSubject :: Message s a -> Text Source #

getForwardedSubject Source #

Arguments

:: Message s a

the encapsulated mail

-> Text 

Returns the subject line formatted for forwarding.

getFrom :: Message s a -> Text Source #

toQuotedMail :: [Mailbox] -> MailBody -> MIMEMessage -> MIMEMessage Source #

Creates a new instance of MIMEMessage with a quoted plain text part if: a) the preferred content type can be extracted b) the text entity can be successfully decoded otherwise an empty plain text body is created

takeFileName :: Text -> Text Source #

Version of takeFileName handling Text values

Attachment handling

toMIMEMessage :: CharsetLookup -> WireEntity -> MIMEMessage Source #

Convert an entity into a MIMEMessage used, for example, when re-composing a draft mail.

chooseEntity :: ContentType -> MIMEMessage -> Maybe WireEntity Source #

Pick a preferred entity to be displayed in the UI.

entityToText :: CharsetLookup -> WireEntity -> Text Source #

Render the entity to be displayed in the UI. If decoding errors, returns an error message instead.

entityToBytes :: MonadError Error m => WireEntity -> m ByteString Source #

Render the entity to be written to the filesystem. In case of a decoding error propagates an Error.

writeEntityToPath :: (MonadError Error m, MonadIO m) => FilePath -> WireEntity -> m FilePath Source #

Low-level function to save the WireEntity to disk.