From a3ee3c50317dcb2aa2b0041ee8c050d35220ff8b Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 20 Nov 2007 18:34:22 +0100 Subject: [PATCH] factor out recording of delayed delivery --- procmail/delay-delivery | 15 ++------------- procmail/record-delayed-mail | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 procmail/record-delayed-mail diff --git a/procmail/delay-delivery b/procmail/delay-delivery index c1ca0c0..3caf9f2 100644 --- a/procmail/delay-delivery +++ b/procmail/delay-delivery @@ -1,6 +1,3 @@ -# create table messages (msgid text unique not null, filename text -# primary key not null unique, release_ts integer not null); - #TODO: create config/delay-(disabled|tonight|weekend) :0 @@ -28,20 +25,12 @@ LOG="delay: delay delivery of $MSGID until $RELEASE_TIME$NL" - DELAYED_QUEUE_DB=$PMVAR/delayed-queue.sqlite - DO_QUERY="$SQLITE $DELAYED_QUEUE_DB" - - DATA="$MSGID" - INCLUDERC=$PMDIR/sql-escape - - Q="insert into messages values - ($DATA, '\\'\$DESTFILE\\'', $RELEASE_TS)" - TRAP="$TRAP; $DO_QUERY '$Q'" - :0 fw |$FORMAIL -I "X-Delayed: $RELEASE_TS ($RELEASE_TIME)" :0 $DELAYED_QUEUE + + INCLUDERC=$PMDIR/record-delayed-mail } } diff --git a/procmail/record-delayed-mail b/procmail/record-delayed-mail new file mode 100644 index 0000000..e83391b --- /dev/null +++ b/procmail/record-delayed-mail @@ -0,0 +1,18 @@ +# create table messages (msgid text unique not null, filename text +# primary key not null unique, release_ts integer not null); + +DELAYED_QUEUE_DB=$PMVAR/delayed-queue.sqlite + +DO_QUERY="$SQLITE $DELAYED_QUEUE_DB" + +DATA="$MSGID" +INCLUDERC=$PMDIR/sql-escape + +QUERY="insert into messages values + ($DATA, '\\'\$DESTFILE\\'', $RELEASE_TS)" +TRAP="$TRAP; $DO_QUERY '$QUERY'" + +QUERY +DATA +DO_QUERY +DELAYED_QUEUE_DB -- 2.39.5