-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A library to read and write mailboxes in mbox format -- -- The library provides functions to read, write, and manipulate mbox's. -- This library focuses on three points: robustness, efficency, and -- scalability. It's using lazy bytestrings and can handle very big -- mailboxes. @package codec-mbox @version 0.2.0.0 module Codec.Mbox -- | An Mbox is a list of MboxMessage newtype Mbox s Mbox :: [MboxMessage s] -> Mbox s mboxMessages :: Mbox s -> [MboxMessage s] -- | An MboxMessage represent an mbox message, featuring the sender, -- the date-time, and the message body. data MboxMessage s MboxMessage :: s -> s -> s -> FilePath -> Int64 -> MboxMessage s _mboxMsgSender :: MboxMessage s -> s _mboxMsgTime :: MboxMessage s -> s _mboxMsgBody :: MboxMessage s -> s _mboxMsgFile :: MboxMessage s -> FilePath _mboxMsgOffset :: MboxMessage s -> Int64 data Direction Backward :: Direction Forward :: Direction -- | Returns a mbox given a direction (forward/backward) and a file path. parseMboxFile :: Direction -> FilePath -> IO (Mbox ByteString) -- | Returns a mbox list given a direction (forward/backward) and a list of -- file path. Note that files are opened lazily. parseMboxFiles :: Direction -> [FilePath] -> IO [Mbox ByteString] -- | Turns a ByteString into an Mbox by splitting on From_ -- lines and unquoting the '>*From's of the message. parseMbox :: ByteString -> Mbox ByteString -- | Same as parseMbox but cat returns an error message. However -- only the line can cause an error message currently, so it's fine to -- dispatch on the either result. safeParseMbox :: FilePath -> Int64 -> ByteString -> Either String (Mbox ByteString) -- | Given a file handle and an offset, parseOneMboxMessage returns -- the message a this offset. parseOneMboxMessage :: FilePath -> Handle -> Integer -> IO (MboxMessage ByteString) -- | Turns an mbox into a ByteString showMbox :: Mbox ByteString -> ByteString -- | Returns a ByteString given an mbox message. showMboxMessage :: MboxMessage ByteString -> ByteString -- | Returns an header line in mbox format given an mbox message. showMboxFromLine :: MboxMessage ByteString -> ByteString -- | Message's sender lens mboxMsgSender :: Functor f => (a -> f a) -> MboxMessage a -> f (MboxMessage a) -- | Message's time lens mboxMsgTime :: Functor f => (a -> f a) -> MboxMessage a -> f (MboxMessage a) -- | Message's body lens mboxMsgBody :: Functor f => (a -> f a) -> MboxMessage a -> f (MboxMessage a) -- | First-class label to the file path of mbox's message mboxMsgFile :: Functor f => (FilePath -> f FilePath) -> MboxMessage a -> f (MboxMessage a) -- | First-class label to the offset of the given message into the mbox mboxMsgOffset :: Functor f => (Int64 -> f Int64) -> MboxMessage a -> f (MboxMessage a) data Month Jan :: Month Feb :: Month Mar :: Month Apr :: Month May :: Month Jun :: Month Jul :: Month Aug :: Month Sep :: Month Oct :: Month Nov :: Month Dec :: Month -- | fromQuoting f s returns s where the quoting level of -- From_ lines has been updated using the f function. -- -- The From_ spefication, quoted from -- http://qmail.org./man/man5/mbox.html: -- --
--   >From quoting ensures that the resulting
--   lines are not From_ lines:  the program prepends a > to any
--   From_ line, >From_ line, >>From_ line, >>>From_ line, etc.
--   
fromQuoting :: (Int64 -> Int64) -> ByteString -> ByteString msgYear :: MboxMessage ByteString -> Int msgMonthYear :: MboxMessage ByteString -> (Month, Int) opposite :: Direction -> Direction instance Eq s => Eq (MboxMessage s) instance Ord s => Ord (MboxMessage s) instance Show s => Show (MboxMessage s) instance Eq s => Eq (Mbox s) instance Ord s => Ord (Mbox s) instance Show s => Show (Mbox s) instance Read Month instance Show Month instance Eq Month