[aiaiai PATCH v3 08/12] email: check the "Old-To:" header as well as "To:" and "Cc:"
Artem Bityutskiy
artem.bityutskiy at linux.intel.com
Fri Feb 7 02:35:54 PST 2014
From: Jacob Keller <jacob.e.keller at intel.com>
In my workflow, a procmail filter determines which project to send a patch
against, and then replaces the "To:" header so that the proper project
receives the patch. However, this results in dropping any other recipients of
the email on the "To:" line. This prevents the reply_all from properly sending
back notices and the test results to everyone. Fix this by recognizing the
"Old-To" header which formail uses to store the previous "To:" data. This
enables aiaiai to keep track of who the original patch was sent to as well,
which in turn fixes the reply_to_all option.
Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
---
email/aiaiai-email-lda | 2 ++
email/aiaiai-email-test-patchset | 10 ++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/email/aiaiai-email-lda b/email/aiaiai-email-lda
index c212a8a..faf9055 100755
--- a/email/aiaiai-email-lda
+++ b/email/aiaiai-email-lda
@@ -88,9 +88,11 @@ reject_and_reply()
fetch_header_or_die from "From" < "$file"
fetch_header_or_die id "Message-Id" < "$file"
+ old_to="$(fetch_header "Old-To" < "$mbox")"
to="$(fetch_header "To" < "$mbox")"
cc="$(fetch_header "Cc" < "$mbox")"
to="$(merge_addresses "$to" "$cc")"
+ to="$(merge_addresses "$to" "$old_to")"
prj="$(fetch_project_name "$to" "$cfg_ownmail")"
verbose "Project \"$prj\""
diff --git a/email/aiaiai-email-test-patchset b/email/aiaiai-email-test-patchset
index 133deea..94b50cb 100755
--- a/email/aiaiai-email-test-patchset
+++ b/email/aiaiai-email-test-patchset
@@ -189,12 +189,13 @@ tmpdir="$(mktemp --tmpdir="$cfg_workdir" -dt "$PROG.XXXX")"
mv $verbose -- "$mbox" "$tmpdir/mbox" >&2
mbox="$tmpdir/mbox"
+old_to="$(fetch_header "Old-To" < "$mbox")"
to="$(fetch_header "To" < "$mbox")"
cc="$(fetch_header "Cc" < "$mbox")"
-# Either "To:" or "Cc:" must exist
-if [ -z "$to" ] && [ -z "$cc" ]; then
- die "Neither \"To:\" nor \"Cc:\" header found"
+# One of "Old-To:" "To:" or "Cc:" must exist
+if [[ -z "$to" ]] && [[ -z "$cc" ]] && [[ -z "$old_to" ]]; then
+ die "Neither \"To:\", \"Old-To:\" nor \"Cc:\" header found"
fi
# Find out the project name
@@ -234,8 +235,9 @@ EOF
exit 0
fi
-# Merge the "To" and "Cc" addresses
+# Merge the "To", "Cc", and "Old_To" addresses
to="$(merge_addresses "$to" "$cc")"
+to="$(merge_addresses "$to" "$old_to")"
if [ "$cfg_reply_to_all" != "1" ]; then
to=
--
Best Regards,
Artem Bityutskiy
More information about the aiaiai
mailing list