purebred-0.1.0.0: An mail user agent built around notmuch

Safe HaskellNone
LanguageHaskell2010

Storage.Notmuch

Contents

Synopsis

Synopsis

The purpose of this module is to provide a bridge between the low-level API of notmuch and the higher level functionality in Purebred. It propagates errors picked up by callers in order to be set in the AppState. The module also serves as a translation between notmuch data types and Purebreds. The latter are used in the UI.

API

Threads

getThreads :: (MonadError Error m, MonadIO m) => Text -> NotmuchSettings FilePath -> m (V (Toggleable NotmuchThread)) Source #

creates a vector of threads from a notmuch search

getThreadMessages :: (MonadError Error m, MonadIO m, Traversable t) => FilePath -> t NotmuchThread -> m (Vector (Toggleable NotmuchMail)) Source #

Returns a vector of *all* messages belonging to the list of threads

countThreads :: (MonadError Error m, MonadIO m) => Text -> FilePath -> m Int Source #

Return the number of threads for the given query

Messages

messageTagModify Source #

Arguments

:: (Traversable t, MonadError Error m, MonadIO m) 
=> FilePath

database

-> [TagOp] 
-> t NotmuchMail 
-> m (t NotmuchMail) 

apply tag operations on all given mails and write the resulting tags to the database

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

Returns the absolute path to the email. Typically used by the email parser.

indexFilePath Source #

Arguments

:: (MonadError Error m, MonadIO m) 
=> FilePath

database

-> FilePath

mail

-> [Tag] 
-> m () 

unindexFilePath Source #

Arguments

:: (MonadError Error m, MonadIO m) 
=> FilePath

database

-> FilePath

mail

-> m () 

Tagging (Labels)

class ManageTags a where Source #

Methods

tags :: Lens' a [Tag] Source #

Instances
ManageTags NotmuchThread Source # 
Instance details

Defined in Storage.Notmuch

Methods

tags :: Lens' NotmuchThread [Tag] Source #

ManageTags NotmuchMail Source # 
Instance details

Defined in Storage.Notmuch

Methods

tags :: Lens' NotmuchMail [Tag] Source #

hasTag :: ManageTags a => Tag -> a -> Bool Source #

tagItem :: ManageTags a => [TagOp] -> a -> a Source #

Tag either a NotmuchMail or a NotmuchThread

addTags :: ManageTags a => [Tag] -> a -> a Source #

removeTags :: ManageTags a => [Tag] -> a -> a Source #

Database

getDatabasePath :: IO FilePath Source #

Returns the notmuch database path by executing 'notmuch config get database.path' in a separate process

withDatabase :: (AsNotmuchError e, Mode a, MonadError e m, MonadIO m) => FilePath -> (Database a -> ExceptT e IO c) -> m c Source #

A helper function for opening and performing work on a database. The database is not explicitly closed (GC will take care of that).