From 34bc77692cb57a13dda5b8e7ea1c43fbccfec0af Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Thu, 29 Mar 2018 20:17:20 +0000 Subject: mda: support v2 inboxes I mainly focus on -watch for mirroring busy mailing lists, but using -mda should remain an option. --- script/public-inbox-mda | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'script') diff --git a/script/public-inbox-mda b/script/public-inbox-mda index f1eaf629..766d58a6 100755 --- a/script/public-inbox-mda +++ b/script/public-inbox-mda @@ -78,8 +78,18 @@ if (ref($ret) && $ret->isa('Email::MIME')) { # filter altered message } # else { accept PublicInbox::MDA->set_list_headers($mime, $dst); -my $git = PublicInbox::Git->new($main_repo); -my $im = PublicInbox::Import->new($git, $dst->{name}, $recipient); +my $v = $dst->{version} || 1; +my $im; +if ($v == 2) { + require PublicInbox::V2Writable; + $im = PublicInbox::V2Writable->new($dst); + $im->{parallel} = 0; # pointless to be parallel for a single message +} elsif ($v == 1) { + my $git = $dst->git; + $im = PublicInbox::Import->new($git, $dst->{name}, $recipient, $dst); +} else { + die "Unsupported inbox version: $v\n"; +} if (defined $im->add($mime)) { $emm = $emm->abort; } else { -- cgit v1.2.3-24-ge0c7