Skip to content

Commit 8ff7ce9

Browse files
committed
Update fredrick to reply to mailing lists correctly
1 parent 2e02cb6 commit 8ff7ce9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,20 @@ ORIGINAL_SUBJECT=$(echo "$EMAIL" | mhdr -h subject -)
3333
LIST_ID=$(echo "$EMAIL" | mhdr -h list-id -)
3434
if [ "$LIST_ID" != "" ]; then
3535
# We don't reply to all mailing list posts.
36-
SHOULD_REPLY=$(awk 'BEGIN { srand(); print rand() <= 0.25 }')
36+
SHOULD_REPLY=$(awk 'BEGIN { srand(); print rand() <= 0.75 }')
3737
if [ "$SHOULD_REPLY" = "0" ]; then
3838
echo "fredrick: don't feel like replying to mailing list post (\"$ORIGINAL_SUBJECT\")."
3939
exit 0
4040
fi
41+
42+
# If we're replying to a mailing list, the recipient should actually be the list address
43+
RECIPIENT=$(echo "$EMAIL" | maddr -a -h x-original-to -)
44+
45+
# If we couldn't find the original recipient, abort here
46+
if [ "$RECIPIENT" = "" ]; then
47+
echo "fredrick: couldn't determine original recipient for mailing list post (\"$ORIGINAL_SUBJECT\")."
48+
exit 0
49+
fi
4150
fi
4251

4352
# Construct the reply subject

0 commit comments

Comments
 (0)