This is an automated email from the ASF dual-hosted git repository. sebb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push: new 06d45a1a Allow override so can merge missing mails 06d45a1a is described below commit 06d45a1a4598f707d2f037abe23db450f99224c2 Author: Sebb <s...@apache.org> AuthorDate: Wed Jan 3 23:13:57 2024 +0000 Allow override so can merge missing mails --- tools/deliver.rb | 7 ++++++- www/secretary/workbench/deliver.rb | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/deliver.rb b/tools/deliver.rb index 2be71300..7c23cd52 100644 --- a/tools/deliver.rb +++ b/tools/deliver.rb @@ -6,6 +6,11 @@ require 'digest' require 'fileutils' MAIL_ROOT = '/srv/mail' +YYYYMM = ARGV.shift # Override for merging mails later +if YYYYMM + raise ArgumentError.new("Invalid yyyymm override #{YYYYMM}") unless YYYYMM =~ /\A20[23]\d(0\d|1[012])\z/ + $stderr.puts "Overriding YYYYMM: #{YYYYMM}" +end # get the message ID def self.getmid(hdrs) @@ -28,7 +33,7 @@ hdrs = mail[/\A(.*?)\r?\n\r?\n/m, 1] || '' # extract info dest = hdrs[/^List-Id: <(.*)>/, 1] || hdrs[/^Delivered-To.* (\S+)\s*$/, 1] || 'unknown' list = dest[/^[-\w]+/] -month = Time.now.strftime('%Y%m') +month = YYYYMM || Time.now.strftime('%Y%m') hash = Digest::SHA1.hexdigest(getmid(hdrs) || mail)[0..9] # build file name diff --git a/www/secretary/workbench/deliver.rb b/www/secretary/workbench/deliver.rb index 7a7cc74c..01c84692 100644 --- a/www/secretary/workbench/deliver.rb +++ b/www/secretary/workbench/deliver.rb @@ -2,6 +2,12 @@ # Process email as it is received # +YYYYMM = ARGV.shift # Override for merging mails later +if YYYYMM + raise ArgumentError.new("Invalid yyyymm override #{YYYYMM}") unless YYYYMM =~ /\A20[23]\d(0\d|1[012])\z/ + $stderr.puts "Overriding YYYYMM: #{YYYYMM}" +end + Dir.chdir File.dirname(File.expand_path(__FILE__)) require_relative 'models/mailbox' @@ -24,7 +30,7 @@ rescue => e end # construct message -month = Time.now.strftime('%Y%m') +month = YYYYMM || Time.now.strftime('%Y%m') mailbox = Mailbox.new(month) message = Message.new(mailbox, hash, headers, email)