Safe Haskell | None |
---|---|
Language | Haskell2010 |
Storage.ParsedMail
Synopsis
- parseMail :: (MonadError Error m, MonadIO m) => NotmuchMail -> FilePath -> m MIMEMessage
- bodyToDisplay :: (MonadMask m, MonadError Error m, MonadIO m) => AppState -> Int -> CharsetLookup -> ContentType -> MIMEMessage -> m (MIMEMessage, MailBody)
- findMatchingWords :: Text -> MailBody -> MailBody
- removeMatchingWords :: MailBody -> MailBody
- makeScrollSteps :: MailBody -> [ScrollStep]
- getTo :: Message s a -> Text
- getSubject :: Message s a -> Text
- getForwardedSubject :: Message s a -> Text
- getFrom :: Message s a -> Text
- toQuotedMail :: [Mailbox] -> MailBody -> MIMEMessage -> MIMEMessage
- takeFileName :: Text -> Text
- toMIMEMessage :: CharsetLookup -> WireEntity -> MIMEMessage
- chooseEntity :: ContentType -> MIMEMessage -> Maybe WireEntity
- entityToText :: CharsetLookup -> WireEntity -> Text
- entityToBytes :: MonadError Error m => WireEntity -> m ByteString
- writeEntityToPath :: (MonadError Error m, MonadIO m) => FilePath -> WireEntity -> m FilePath
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
getSubject :: Message s a -> Text Source #
Arguments
:: Message s a | the encapsulated mail |
-> Text |
Returns the subject line formatted for forwarding.
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.