aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2025-02-03 21:22:11 +0100
committerGravatar Johannes Christ <[email protected]>2025-02-03 21:52:41 +0100
commit6d1a9a8437b92f48dc215d060919e6c3290d3f5f (patch)
treec94632f8f7f8989aaf123416826e5437de74591a
parentLearn from Fredrick's therapy results (diff)
Have Fredrick only reply to 25% of mailing list posts
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.j210
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 7fe77b3..609d37f 100644
--- a/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2
+++ b/ansible/roles/postfix/templates/services/fredrick-reply.sh.j2
@@ -30,6 +30,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"