From 43637a4b0d4bd08e3a36155a84b7e3e05c6bd67f Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Sun, 14 Sep 2008 13:26:32 +0200 Subject: [PATCH 1/1] deliver delayed/tickled mail as read --- bin/resubmit | 12 ++++++++++-- procmail/defines | 5 +++++ procmail/tickle | 3 +++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bin/resubmit b/bin/resubmit index c51244b..6227584 100755 --- a/bin/resubmit +++ b/bin/resubmit @@ -19,13 +19,15 @@ usage() -V|--version & show version information. -h|--help & show this output. -l|--list & process the argument list (even if empty), never stdin + -r|--deliver-read & mark messages read on delivery _eof } -SHORTOPTS=Vhl -LONGOPTS=version,help,list +SHORTOPTS=Vhlr +LONGOPTS=version,help,list,deliver-read list=0 +mark_read=0 files= for opt in $(getopt -n $ME -o $SHORTOPTS -l $LONGOPTS -u -- "$@"); do @@ -33,6 +35,7 @@ for opt in $(getopt -n $ME -o $SHORTOPTS -l $LONGOPTS -u -- "$@"); do -V|--version) about; exit 0;; -h|--help) about; echo; usage; exit 0;; -l|--list) list=1;; + -r|--deliver-read) mark_read=1;; --) :;; *) if [ -f "$opt" ] && [ -r "$opt" ]; then @@ -46,6 +49,11 @@ for opt in $(getopt -n $ME -o $SHORTOPTS -l $LONGOPTS -u -- "$@"); do done PROCMAIL=$HOME/.etc/mailfilter/procmail/procmailrc + +if [ "$mark_read" -eq 1 ]; then + PROCMAIL="$PROCMAIL DELIVER_READ=1" +fi + # execute the date -R only during the eval, not immediately FILTER='/usr/bin/formail -I"X-Resubmitted: $(date -R)"' diff --git a/procmail/defines b/procmail/defines index e96e7f0..bdc3167 100644 --- a/procmail/defines +++ b/procmail/defines @@ -237,4 +237,9 @@ DELAY # released. Overrides DELAY. RELEASE +# MARK_READ +# when set, causes mails to be marked as read when delivered. Can be +# initialised with DELIVER_READ +MARK_READ=$DELIVER_READ + # vim:ft=procmail diff --git a/procmail/tickle b/procmail/tickle index 5038410..cc03d4a 100644 --- a/procmail/tickle +++ b/procmail/tickle @@ -59,6 +59,9 @@ :0 fw |$FORMAIL -I"X-Tickle: $RELEASE" + # store messages as read + MARK_READ=true + # unset DISABLE_DELAYS to always enable delaying for tickle messages DISABLE_DELAYS } -- 2.39.5