Skip to content

Commit 6d1a9a8

Browse files
committed
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.
1 parent 8476718 commit 6d1a9a8

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

ansible/roles/postfix/templates/services/fredrick-reply.sh.j2

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ MESSAGE_DATE=$(echo "$EMAIL" | mhdr -h date -)
3030
# Extract the original Subject and prefix it with "Re: " if necessary
3131
ORIGINAL_SUBJECT=$(echo "$EMAIL" | mhdr -h subject -)
3232

33+
LIST_ID=$(echo "$EMAIL" | mhdr -h list-id -)
34+
if [ "$LIST_ID" != "" ]; then
35+
# We don't reply to all mailing list posts.
36+
SHOULD_REPLY=$(awk 'BEGIN { srand(); print rand() <= 0.25 }')
37+
if [ "$SHOULD_REPLY" = "0" ]; then
38+
echo "fredrick: don't feel like replying to mailing list post (\"$ORIGINAL_SUBJECT\")."
39+
exit 0
40+
fi
41+
fi
42+
3343
# Construct the reply subject
3444
REPLY_SUBJECT="Re: $ORIGINAL_SUBJECT"
3545

0 commit comments

Comments
 (0)