diff options
author | Eric Wong <e@80x24.org> | 2014-11-13 21:51:42 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2014-11-13 21:51:42 +0000 |
commit | f0ba219d00c4634a055ec364092284630cdbe9e1 (patch) | |
tree | ee46d82b1912608f3d94a3a20742c663896e4dad /public-inbox-learn | |
parent | 75f6b34d08825b8d80de1ceda2a37e18ddde75a6 (diff) | |
download | public-inbox-f0ba219d00c4634a055ec364092284630cdbe9e1.tar.gz |
Sometimes people send HTML email and I forget to fixup in my MUA during moderation. Automatically strip out HTML portions instead.
Diffstat (limited to 'public-inbox-learn')
-rwxr-xr-x | public-inbox-learn | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/public-inbox-learn b/public-inbox-learn index 13b75b76..db0a1bb3 100755 --- a/public-inbox-learn +++ b/public-inbox-learn @@ -24,9 +24,16 @@ foreach my $h (qw(Cc To)) { } } -my $in = $mime->as_string; -$mime->body_set(''); +my ($name, $email, $date); + +if ($train eq "ham") { + require PublicInbox::MDA; + require PublicInbox::Filter; + PublicInbox::Filter->run($mime); + ($name, $email, $date) = PublicInbox::MDA->author_info($mime); +} +my $in = $mime->as_string; my $err = 0; my @output = qw(> /dev/null > /dev/null); @@ -50,16 +57,10 @@ foreach my $recipient (keys %dests) { } } } else { # $train eq "ham" - require PublicInbox::MDA; - require PublicInbox::Filter; - - # no checking for errors here, we assume the message has + # no checking for spam here, we assume the message has # been reviewed by a human at this point: - PublicInbox::Filter->run($mime); PublicInbox::MDA->set_list_headers($mime, $dst); - my ($name, $email, $date) = - PublicInbox::MDA->author_info($mime); local $ENV{GIT_AUTHOR_NAME} = $name; local $ENV{GIT_AUTHOR_EMAIL} = $email; local $ENV{GIT_AUTHOR_DATE} = $date; |