summaryrefslogtreecommitdiff
path: root/split-mailman-mails-and-discard-and-save
diff options
context:
space:
mode:
Diffstat (limited to 'split-mailman-mails-and-discard-and-save')
-rwxr-xr-xsplit-mailman-mails-and-discard-and-save36
1 files changed, 17 insertions, 19 deletions
diff --git a/split-mailman-mails-and-discard-and-save b/split-mailman-mails-and-discard-and-save
index 9dc5b1a..3478b85 100755
--- a/split-mailman-mails-and-discard-and-save
+++ b/split-mailman-mails-and-discard-and-save
@@ -7,13 +7,13 @@ if ARGV[0] == "spam"
MAILIN="mail/spam-in"
MAILLEARN="mail/spam-learn"
OUTBOX="mail/outbox"
- SEND_CONFIRM_MAIL = true
+ DO_APPROVE = false
APPROVE_PASSWORD = nil
elsif ARGV[0] == "ham"
MAILIN="mail/ham-in"
MAILLEARN="mail/ham-learn"
OUTBOX="mail/outbox"
- SEND_CONFIRM_MAIL = true
+ DO_APPROVE = true
APPROVE_PASSWORD = YAML::load( File.open( 'mailman-passwords.yaml' ) )
else
STDERR.puts "Usage: #{$0} ham|spam"
@@ -84,23 +84,21 @@ def process_mail(filename)
store_in_maildir(MAILLEARN, held_part)
- if SEND_CONFIRM_MAIL
- if APPROVE_PASSWORD and not APPROVE_PASSWORD[request_address] then
- mail_error = RMail::Message.new()
- mail_error.header['From'] = FROM
- mail_error.header['To'] = ERRORSTO
- mail_error.header['Subject'] = "approving #{cookie} failed"
- mail_error.body = 'Sorry, this script does not have the admin/moderator password for #{request_address}.'
- store_in_maildir(OUTBOX, mail_request)
- else
- 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.header['Approved'] = APPROVE_PASSWORD if APPROVE_PASSWORD
- mail_request.body = ''
- store_in_maildir(OUTBOX, mail_request)
- end
+ if DO_APPROVE and not APPROVE_PASSWORD[request_address] then
+ mail_error = RMail::Message.new()
+ mail_error.header['From'] = FROM
+ mail_error.header['To'] = ERRORSTO
+ mail_error.header['Subject'] = "approving #{cookie} failed"
+ mail_error.body = 'Sorry, this script does not have the admin/moderator password for #{request_address}.'
+ store_in_maildir(OUTBOX, mail_request)
+ else
+ 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.header['Approved'] = APPROVE_PASSWORD[request_address] if DO_APPROVE
+ mail_request.body = ''
+ store_in_maildir(OUTBOX, mail_request)
end
end