From 3b702816ce991cca485fe0736d643d327d54c4ce Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 18 Jun 2006 15:07:48 +0000 Subject: Rewrite header for all mails git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@142 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- split-mailman-mails-and-discard-and-save | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'split-mailman-mails-and-discard-and-save') diff --git a/split-mailman-mails-and-discard-and-save b/split-mailman-mails-and-discard-and-save index 45e449f..10cdd88 100755 --- a/split-mailman-mails-and-discard-and-save +++ b/split-mailman-mails-and-discard-and-save @@ -224,6 +224,17 @@ def process_mail(filename) spam_info.body = sa_text + "\n\n" + bogo_text message.body.unshift spam_info + + # rewrite Delivered-To to X-OLD-Delivered-To to avoid mail loop warnings. + m = message.to_s.split(/\n/) + new_m = [] + while m.size > 0 and (line = m.shift) != "" + new_m << line.gsub(/^Delivered-To:/, 'X-OLD-Delivered-To:') + end + new_m.concat m + message = new_m + + if sa_class == "Ham" and bogo_class == "Ham" store_in_maildir(MAIL_PROCESSED_HAM, message) approve(cookie, request_address) @@ -236,15 +247,7 @@ def process_mail(filename) discard(cookie, request_address) else store_in_maildir(MAIL_PROCESSED_FORWARDED, message) - - # rewrite Delivered-To to X-OLD-Delivered-To to avoid mail loop warnings. - m = message.to_s.split(/\n/) - new_m = [] - while m.size > 0 and (line = m.shift) != "" - new_m << line.gsub(/^Delivered-To:/, 'X-OLD-Delivered-To:') - end - new_m.concat m - store_in_maildir(OUTBOX_HUMANS, new_m.join("\n")) + store_in_maildir(OUTBOX_HUMANS, message.join("\n")) end else STDERR.puts "Unknown action #{ACTION}!" -- cgit v1.2.3