mail: Add basic filtering system
imapfilter now looks for account information in an accounts.lua file in its configuration directory -- the file should return account information as a table with each account being a top-level entry in the table. A sample spam-moving script has been supplied: For now, it will take a list of sender addresses and put everything in the list from the inbox into the dump directory. An example list of senders has been supplied for testing purposes, but this should eventually be read from a file containing an extensible list of senders (and perhaps even different properties such as subject, etc.) The imapfilter xdg alias has been fixed. Coherence between the imap folder structure and notmuch tagging system still has to be achieved -- either by aerc using the folder structure as a query map, or notmuch tags automatically being applied for specific imap filtering options.
This commit is contained in:
parent
1564aa8176
commit
5a256186c2
8 changed files with 102 additions and 42 deletions
|
|
@ -12,12 +12,9 @@
|
|||
# https://sourceforge.net/p/isync/feature-requests/8/
|
||||
|
||||
MBSYNC_MAX_TRIES=3
|
||||
MBSYNC_PRE="imapfilter"
|
||||
MBSYNC_PRE="imapfilter -c /home/marty/.config/imapfilter/config.lua"
|
||||
MBSYNC_POST="notmuch new"
|
||||
|
||||
success="false"
|
||||
tries=0
|
||||
|
||||
# fail the routine and optionally send a message why
|
||||
fail() {
|
||||
[ -n "$1" ] && echo "$1"
|
||||
|
|
@ -43,15 +40,23 @@ if [ "$1" = "raw" ]; then
|
|||
exit
|
||||
fi
|
||||
|
||||
$MBSYNC_PRE
|
||||
while true; do
|
||||
if checkmail; then
|
||||
success="true"
|
||||
fi
|
||||
main() {
|
||||
$MBSYNC_PRE
|
||||
|
||||
if [ $success = "true" ] || [ $tries -gt $MBSYNC_MAX_TRIES ]; then
|
||||
fail "Maximum retries reached unsuccessfully."
|
||||
fi
|
||||
tries=$((tries + 1))
|
||||
done
|
||||
$MBSYNC_POST
|
||||
tries=0
|
||||
while true; do
|
||||
if checkmail; then
|
||||
break
|
||||
fi
|
||||
|
||||
tries=$((tries + 1))
|
||||
if [ $tries -gt $MBSYNC_MAX_TRIES ]; then
|
||||
fail "maximum retries reached without success."
|
||||
fi
|
||||
done
|
||||
unset tries
|
||||
|
||||
$MBSYNC_POST
|
||||
}
|
||||
|
||||
main
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue