diff options
author | 2025-02-03 21:22:11 +0100 | |
---|---|---|
committer | 2025-02-03 21:22:11 +0100 | |
commit | 73fe66cec94f55120efbad480a23bbcd31663b5f (patch) | |
tree | 14197afc3d5cfc2d654cf265b2bcfe4eb02ec4b0 | |
parent | Update ansible (diff) |
Have Fredrick only reply to 25% of mailing list postsfredrick-mailing-list-adjustments
Fredrick has recently gotten more depressive as a result of the weather.
He therefore no longer wishes to reply to each and every mailing list
post.
-rw-r--r-- | ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 b/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 index b33c7c4..e9dee0c 100644 --- a/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 +++ b/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2 @@ -27,6 +27,16 @@ MESSAGE_DATE=$(echo "$EMAIL" | mhdr -h date -) # Extract the original Subject and prefix it with "Re: " if necessary ORIGINAL_SUBJECT=$(echo "$EMAIL" | mhdr -h subject -) +LIST_ID=$(echo "$EMAIL" | mhdr -h list-id -) +if [ "$LIST_ID" != "" ]; then + # We don't reply to all mailing list posts. + SHOULD_REPLY=$(awk 'BEGIN { srand(); print rand() <= 0.25 }') + if [ "$SHOULD_REPLY" = "0" ]; then + echo "fredrick: don't feel like replying to mailing list post (\"$ORIGINAL_SUBJECT\")." + exit 0 + fi +fi + # Construct the reply subject REPLY_SUBJECT="Re: $ORIGINAL_SUBJECT" |