Safe Haskell | Safe |
---|---|
Language | Haskell98 |
- data EmailAddress = Addr String
- data Mailbox = Mailbox String
- data CExp = CExp [Flag] Cond Act
- data Flag
- = Copy
- | Wait
- | IgnoreErrors
- | RawWrite
- | NeedLock Bool
- | Chain
- | CaseSensitive
- data Cond
- data Act
- (.&&.) :: Cond -> Cond -> Cond
- (.||.) :: Cond -> Cond -> Cond
- subject :: String -> Cond
- body :: String -> Cond
- said :: String -> Cond
- from :: EmailAddress -> Cond
- to :: EmailAddress -> Cond
- to_ :: EmailAddress -> Cond
- when :: Cond -> Act -> Writer [CExp] ()
- whenWithOptions :: [Flag] -> Cond -> Act -> Writer [CExp] ()
- placeIn :: Mailbox -> Act
- also :: Act -> Act -> Act
- flagAllButLast :: Flag -> [CExp] -> [CExp]
- addFlag :: Flag -> CExp -> CExp
- removeFlag :: Flag -> CExp -> CExp
- forwardTo :: [EmailAddress] -> Act
- isSpam :: Cond
- spamLevel :: Int -> Cond
- data Match a = Match a
- match :: Match String
- whenMatch :: Match Cond -> Match Act -> Writer [CExp] ()
- whenMatchWithOptions :: [Flag] -> Match Cond -> Match Act -> Writer [CExp] ()
- placeInUsingMatch :: Match Mailbox -> Match Act
- (%) :: Cond -> String -> Match Cond
- refineBy :: Match Cond -> Match Cond -> Match Cond
- alsoUsingMatch :: Match Act -> Match Act -> Match Act
- sortBy :: (a -> Cond) -> a -> Mailbox -> Writer [CExp] ()
- sortByTo_ :: EmailAddress -> Mailbox -> Writer [CExp] ()
- sortByTo :: EmailAddress -> Mailbox -> Writer [CExp] ()
- sortByFrom :: EmailAddress -> Mailbox -> Writer [CExp] ()
- sortBySubject :: String -> Mailbox -> Writer [CExp] ()
- simpleSortByFrom :: String -> Writer [CExp] ()
- simpleSortByTo_ :: String -> Writer [CExp] ()
- simpleSortByTo :: String -> Writer [CExp] ()
- mailbox :: String -> Mailbox
- mailBoxFromMatch :: Match String -> Match Mailbox
- lock :: Flag
- type Class = (String, [Cond])
- type Trigger = (String, Int, Act)
- type Classifier = Writer [CExp] ()
- mkTrigger :: Trigger -> Classifier
- mkClassifiers :: Class -> Writer [CExp] ()
- incrementHeader :: String -> Int -> [CExp]
- mkHeader :: String -> String
- classify :: [Class] -> [Trigger] -> Writer [CExp] ()
- classifyBy :: (String, Cond) -> Act -> Writer [CExp] ()
- classifyByAddress :: (EmailAddress -> Cond) -> EmailAddress -> Mailbox -> Writer [CExp] ()
- classifyByTo_ :: EmailAddress -> Mailbox -> Writer [CExp] ()
- classifyByTo :: EmailAddress -> Mailbox -> Writer [CExp] ()
- classifyByFrom :: EmailAddress -> Mailbox -> Writer [CExp] ()
- classifyByFromAddr :: String -> String -> Writer [CExp] ()
- classifyBySubject :: String -> Mailbox -> Writer [CExp] ()
- simpleClassifyBySubject :: String -> Writer [CExp] ()
- simpleClassifyByFrom :: String -> Writer [CExp] ()
- simpleClassifyByTo_ :: String -> Writer [CExp] ()
- simpleClassifyByTo :: String -> Writer [CExp] ()
- defaultRule :: String -> Writer [CExp] ()
- subjectToMbox :: String -> String -> Writer [CExp] ()
- addressToMbox :: String -> String -> Writer [CExp] ()
- toAddressToMbox :: String -> String -> Writer [CExp] ()
- stuffToMbox :: Cond -> (a1 -> a) -> (a -> Cond -> Cond) -> String -> [a1] -> Writer [CExp] ()
- subjectsToMbox :: [String] -> String -> Writer [CExp] ()
- anySubjectsToMbox :: [String] -> String -> Writer [CExp] ()
- insertMbox :: String -> Act
Documentation
from :: EmailAddress -> Cond Source #
to :: EmailAddress -> Cond Source #
to_ :: EmailAddress -> Cond Source #
forwardTo :: [EmailAddress] -> Act Source #
sortByFrom :: EmailAddress -> Mailbox -> Writer [CExp] () Source #
simpleSortByFrom :: String -> Writer [CExp] () Source #
If the email address (the String argument) contains "foo", then place the email into a folder by the name "foo". Actually, the name of the mailbox is created by appending boxPrefix which is defined in the Configuration module.
type Classifier = Writer [CExp] () Source #
mkTrigger :: Trigger -> Classifier Source #
classifyByAddress :: (EmailAddress -> Cond) -> EmailAddress -> Mailbox -> Writer [CExp] () Source #
classifyByTo_ :: EmailAddress -> Mailbox -> Writer [CExp] () Source #
classifyByTo :: EmailAddress -> Mailbox -> Writer [CExp] () Source #
classifyByFrom :: EmailAddress -> Mailbox -> Writer [CExp] () Source #
subjectToMbox :: String -> String -> Writer [CExp] () Source #
If the subject line contains a certain string, send it to a certain mailbox.
addressToMbox :: String -> String -> Writer [CExp] () Source #
As with subjectToMbox
, except by email address.
toAddressToMbox :: String -> String -> Writer [CExp] () Source #
addressToMbox
is fine, but may not work well for mailing lists.
stuffToMbox :: Cond -> (a1 -> a) -> (a -> Cond -> Cond) -> String -> [a1] -> Writer [CExp] () Source #
stuffToMbox
is a very general filtering statement, which is intended for specialization
by other functions.
The idea is to take a logical operator and fold it over a list of strings.
If the result is True
, then the email gets dropped into a specified mailbox.
So if you wanted to insist that only an email which has strings x
, y
, and z
in
the subject-line could appear in the xyz mailbox, you'd use .&&. as the logical operator,
"xyz" as the mbox
argument, [x, y, z] as the list, and a seed value of True. You also need the
subject
operator, which will map over the list and turn it into properly typed
stuff.
subjectsToMbox :: [String] -> String -> Writer [CExp] () Source #
If all the strings appear in the subject line, deposit the email in the specified mailbox
anySubjectsToMbox :: [String] -> String -> Writer [CExp] () Source #
If any of the strings appear in the subject line, send it to the mbox This is currently a bit of a null-op, and I'm not sure it works.
insertMbox :: String -> Act Source #