From dff37b95fba027ba8ab52a25967d852f29da4bf7 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 16 May 2006 13:58:35 +0000 Subject: support ham git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@89 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- split-mailman-mails-and-discard-and-save | 36 +++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/split-mailman-mails-and-discard-and-save b/split-mailman-mails-and-discard-and-save index aec0bc8..d5d1ffa 100755 --- a/split-mailman-mails-and-discard-and-save +++ b/split-mailman-mails-and-discard-and-save @@ -2,10 +2,19 @@ require 'rmail' - -MAILIN="mail-in" -SPAM="spam-learn" -OUTBOX="outbox" +if ARGV[0] == "spam" + MAILIN="spam-in" + MAILLEARN="spam-learn" + OUTBOX="outbox" + SEND_DISCARD_MAIL = true +elsif ARGV[0] == "ham" + MAILIN="ham-in" + MAILLEARN="ham-learn" + OUTBOX="outbox" + SEND_DISCARD_MAIL = false +else + stderr.puts "Usage: $0 ham|spam" +end DOMAIN='lists.oftc.net' FROM="listmoderators@lists.oftc.net" @@ -68,17 +77,20 @@ def process_mail(filename) throw "Could not find cookie in discard_part" unless matchdata and matchdata[1] cookie = matchdata[1] - store_in_maildir(SPAM, held_part) - mail_request = RMail::Message.new() - mail_request.header['From'] = FROM - mail_request.header['To'] = request_address - mail_request.header['Subject'] = "Re: confirm #{cookie}" - mail_request.body = '' - store_in_maildir(OUTBOX, mail_request) + store_in_maildir(MAILLEARN, held_part) + + if SEND_DISCARD_MAIL + mail_request = RMail::Message.new() + mail_request.header['From'] = FROM + mail_request.header['To'] = request_address + mail_request.header['Subject'] = "Re: confirm #{cookie}" + mail_request.body = '' + store_in_maildir(OUTBOX, mail_request) + end end check_maildir MAILIN -check_maildir SPAM +check_maildir MAILLEARN check_maildir OUTBOX Dir[MAILIN+"/new/*"].each do |filename| -- cgit v1.2.3