Skip to content

Commit

Permalink
Have Fredrick only reply to 25% of mailing list posts
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jchristgit committed Feb 3, 2025
1 parent 8476718 commit 6d1a9a8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ansible/roles/postfix/templates/services/fredrick-reply.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 6d1a9a8

Please sign in to comment.