4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
5 # mail-route can get messed up a bit randomly, I don't know why.
6 #/b/ds/mail-route up | /b/log-quiet/log-once -1 mail-route
8 for f
in $
(awk '$1 == "localfolders" {print $NF}' ~
/.offlineimaprc
); do
16 if grep -qP '^ *accounts.*fsf' ~
/.offlineimaprc
; then
17 if [[ ! -e /nocow
/user
/.mufsf
]]; then
18 mkdir
-p /nocow
/user
/.mufsf
19 chmod 700 /nocow
/user
/.mufsf
20 mu index
--maildir=/nocow
/user
/fsfmd
24 omv
() { # offlineimap mv. move mail files within $src_base/$1 to /m/md/$2
29 files
=($src_base/"$src"/$x/*)
32 mv "${files[@]}" /m
/md
/"$dst"/$x
37 src_base
=/m
/offlineimap
38 omv
"Sent Items" "Sent"
39 omv INBOX offlineimaptmp
42 sieve-filter
-eW ~
/sieve
/main.sieve offlineimaptmp
&>/dev
/null
43 # the default folder is INBOX for anything leftover
44 omv offlineimaptmp INBOX
45 # remove messages from remote host
47 # this makes us sit and wait when we want to use mu and this is running in a cronjob.
48 # todo: emacs updates the index much faster. what command is it running? I'd like
50 # looks like it might be mu index --lazy-check, but that still takes like 10 seconds,
51 # figure out if that is the same speed, or if we can make it faster.
52 #mu index &>/dev/null ||:
56 # delete based on http://deflexion.com/2006/05/imap-way-of-deleting-message
57 sieve-filter
-eW -o mail_location
=maildir
:/nocow
/user
/fsfmd
:LAYOUT
=fs
:INBOX
=/nocow
/user
/fsfmd
/INBOX ~
/sieve
/fsf.sieve INBOX delete
&>>/tmp
/fsfsieve.log
59 # to test new rules, update fsf-test.sieve, run these commands, then copy new fsf-test.sieve to fsf.sieve
60 # sieve-filter -o mail_location=maildir:/nocow/user/fsfmd:LAYOUT=fs:INBOX=/nocow/user/fsfmd/INBOX ~/sieve/fsf-test.sieve INBOX &>/tmp/testfsfsieve.log
61 # sed -rn '/^Performed actions:/{n;n;p}' /tmp/testfsfsieve.log | sort -u