about summary refs log tree commit homepage
path: root/lib/PublicInbox/WatchMaildir.pm
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-19 08:14:46 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-19 08:16:34 +0000
commit12c3eb5b2b0860292a32d5743ea0157996e9a4b9 (patch)
treee77046682726121988548e0ef968cf33233f3d6d /lib/PublicInbox/WatchMaildir.pm
parent1cc19f3f8ffe37e341e219884c6856210ba6fa52 (diff)
downloadpublic-inbox-12c3eb5b2b0860292a32d5743ea0157996e9a4b9.tar.gz
This allows us to share code for generating Message-IDs
between v1 and v2 repos.

For v1, this introduces a slight incompatibility in message
removal iff the original message lacked a Message-ID AND
the training request came from a message which did not
pass through the public-inbox:

The workaround for this would be to reuse the bad message from
the archive itself.
Diffstat (limited to 'lib/PublicInbox/WatchMaildir.pm')
-rw-r--r--lib/PublicInbox/WatchMaildir.pm14
1 files changed, 0 insertions, 14 deletions
diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm
index f2d3db95..3adebdde 100644
--- a/lib/PublicInbox/WatchMaildir.pm
+++ b/lib/PublicInbox/WatchMaildir.pm
@@ -12,8 +12,6 @@ use PublicInbox::Import;
 use PublicInbox::MDA;
 use PublicInbox::Spawn qw(spawn);
 use File::Temp qw//;
-use PublicInbox::MID qw(mids);
-use PublicInbox::ContentId qw(content_digest);
 
 sub new {
         my ($class, $config) = @_;
@@ -127,7 +125,6 @@ sub _remove_spam {
         # path must be marked as (S)een
         $path =~ /:2,[A-R]*S[T-Za-z]*\z/ or return;
         my $mime = _path_to_mime($path) or return;
-        _force_mid($mime);
         $self->{config}->each_inbox(sub {
                 my ($ibx) = @_;
                 eval {
@@ -146,16 +143,6 @@ sub _remove_spam {
         })
 }
 
-sub _force_mid {
-        my ($mime) = @_;
-        my $hdr = $mime->header_obj;
-        my $mids = mids($hdr);
-        return if @$mids;
-        my $dig = content_digest($mime);
-        my $mid = $dig->clone->hexdigest . '@localhost';
-        $hdr->header_set('Message-Id', $mid);
-}
-
 sub _try_path {
         my ($self, $path) = @_;
         my @p = split(m!/+!, $path);
@@ -191,7 +178,6 @@ sub _try_path {
                 $mime = $ret;
         }
 
-        _force_mid($mime);
         $im->add($mime, $self->{spamcheck});
 }