X-Git-Url: https://git.madduck.net/etc/mailfilter.git/blobdiff_plain/ec33cde8f8ecb3f68c805ce48b4d62838647a739..22ae42b9d0e4e2fc052da922ae9c20bc4862940e:/procmail/deliver diff --git a/procmail/deliver b/procmail/deliver index 928d52c..af2f70c 100644 --- a/procmail/deliver +++ b/procmail/deliver @@ -1,23 +1,43 @@ -VERBOSE=yes :0 -*$ $DEST +*$ DEST ?? ^$NULL$ { + LOG="deliver: sending message $MSGID to $DEST$NL" + :0 - * DEST ?? .+[^/]$ - { DEST="$DEST/" } + $NULL +} - :0 E - *$ DEST ?? ^\. - { DEST="$BASE/$DEST" } +:0 +* ! DEST ?? . +{ DEST=/ } - LOG="deliver: delivering message $MSGID to $DEST$NL" - :0 - $DEST +:0 +* DEST ?? .+[^/]$ +{ DEST="$DEST/" } + +:0 +*$ DEST ?? ^$BASE/\/.+ +{ DEST="$MATCH" } + +:0 +*$ ! DEST ?? ^\. +{ DEST=".$DEST" } + +:0 +* MARK_READ ?? . +{ + LOG="deliver: marking messages $MSGID as read because of $MARK_READ$NL" + TRAP="$TRAP; BASENAME=\"\${DESTFILE##*/}:2,S\"" + TRAP="$TRAP; DIRNAME=\"\${DESTFILE%/new/*}/cur\"" + TRAP="$TRAP; DESTFILE=\"\$DIRNAME/\$BASENAME\"" + TRAP="$TRAP; mv \"\$LASTFOLDER\" \"$BASE/\$DESTFILE\"" } -:0 E +:0 { - LOG="deliver: delivering message $MSGID to default destination$NL" + LOG="deliver: delivering message $MSGID to $DEST$NL" + TRAP="$TRAP; echo \"delivered: \$DESTFILE\" >> '$THISLOGFILE'" + :0 - $DEFAULT + $BASE/$DEST }