# define the database for duplicates, use the message-id header for it and keep the database for 1 month; fdm needs to be built with 'make DB=1' to use this
$db = "~/.fdm.duplicate-db"
$key = "%[message_id]"
cache $db expire 1 month

# a reasonable timeout for my pop3s server
set timeout 60

# my maildirs à la pine, with action, month and two digits year tags
action 'received' maildir "%h/.maildir/%t-%m-%[year2]"
action 'banca' maildir "%h/.maildir/%t-%m-%[year2]"
action 'crux' maildir "%h/.maildir/%t-%m-%[year2]"
action 'tuxonice' maildir "%h/.maildir/%t-%m-%[year2]"
action 'dwm' maildir "%h/.maildir/%t-%m-%[year2]"
action 'vimperator' maildir "%h/.maildir/%t-%m-%[year2]"
action 'filosofia' maildir "%h/.maildir/%t-%m-%[year2]"
action 'sent' maildir "%h/.maildir/%t-%m-%[year2]"
action 'osml' maildir "%h/.maildir/%t-%m-%[year2]"
# a general maildir for cron jobs
action 'cron' maildir "%h/.maildir/%t"
# a sound for all my mails
action 'sound' exec "/usr/bin/aplay -q ~/.xchat2/sounds/bong.au"
# esmtp, my very simple MTA, is able to deliver local mail from cron jobs and so, but does not add Date: and From: headers
action 'esmtpdate' add-header "From" "%u@%[hostname]"
action 'esmtpfrom' add-header "Date" "%[rfc822date]"
# the maildir for duplicates, since some false duplicates can be detected when a previous instance of fdm gets interrupted
action 'duplicates' maildir "%h/.maildir/%t"
# the standard drop and keep actions
action 'null' drop
action 'one' keep
	
# my gmail account
account 'gmail' pop3s server "pop.gmail.com" port 995 user "x" pass "y"
# the standard input account
account 'stdin' disabled stdin

# first of all, the sound
match all action "sound" continue
# add the missing headers for local mail
match account "stdin" action 'esmtpdate' continue
match account "stdin" action 'esmtpfrom' continue
# cron jobs
match account "stdin" and "^(From).*(root|patroclo7|mvpozzato)" in headers and "^(Subject).*(cron)" in headers action "cron"
# local mail does not need to be filtered any further
match account "stdin" action "received"
# catch duplicates
match not string $key to "" {
       match in-cache $db key $key action "duplicates"
       }
# update the duplicates db
match all action to-cache $db key $key continue
# drop
match "^(From).*(postmaster\@postmaster\.libero\.it)" in headers action "null"
# the mails I have sent from gmail web interface 
match "^(From).*(patroclo7\@gmail.com)" in headers action "sent"
# philosophy mailing lists; stuff about jobs needs to be also in the default maildir 
match "^(To|List-Id).*(liverpool|swif|sequitur)" in headers {
       match "^(Subject).*(job)" in headers action "received" continue
       match all action "filosofia"
       }
# bank stuff
match "^(From).*(iwbank)" in headers action "banca"
# stuff from OS mailing lists and forums
match "^(To|List-Id).*(crux)" in headers action "crux"
match "^(To|List-Id).*(vimperator)" in headers action "vimperator"
match "^(To|List-Id).*(dwm).*(suckless)" in headers action "dwm"
match "^(To|List-Id).*(suspend2|tuxonice)" in headers action "tuxonice"
match "^(To|List-Id).*(archlinux|crealabs|fdm-users|fish-users|metalog-users|conkeror|ratpoison|muttprint|screen-users|suspend2|rxvt-unicode)" in headers or "^(Return-Path).*(crealabs|pharsc2|archlinux)" in headers action "osml"

# the default destination
match all action "received"

