From e7d13d7bc4a7b1e990602e796b7c2acbddb99a7b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 22 Mar 2021 07:54:02 +0000 Subject: lei import: ignore Status headers in "eml" messages Those headers only have meaning with for mboxes. Don't surprise users by trying to make sense of a header that is defined for mboxes. It's possible to send email with (Status|X-Status) headers and have those headers show up in a recipient's IMAP mailbox. This was bad because an IMAP user may want to import a single message through their MUA and pipe its contents to "lei import" without noticing a mischievious sender stuck "X-Status: F" (flagged/important) in there. --- lib/PublicInbox/LeiImport.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm index 767cae60..9ad2ff12 100644 --- a/lib/PublicInbox/LeiImport.pm +++ b/lib/PublicInbox/LeiImport.pm @@ -10,19 +10,19 @@ use PublicInbox::Eml; use PublicInbox::PktOp qw(pkt_do); sub eml_cb { # used by PublicInbox::LeiInput::input_fh - my ($self, $eml) = @_; - my $vmd; - if ($self->{-import_kw}) { # FIXME - my $kw = PublicInbox::MboxReader::mbox_keywords($eml); - $vmd = { kw => $kw } if scalar(@$kw); - } + my ($self, $eml, $vmd) = @_; my $xoids = $self->{lei}->{ale}->xoids_for($eml); $self->{lei}->{sto}->ipc_do('set_eml', $eml, $vmd, $xoids); } sub mbox_cb { # MboxReader callback used by PublicInbox::LeiInput::input_fh my ($eml, $self) = @_; - eml_cb($self, $eml); + my $vmd; + if ($self->{-import_kw}) { + my $kw = PublicInbox::MboxReader::mbox_keywords($eml); + $vmd = { kw => $kw } if scalar(@$kw); + } + eml_cb($self, $eml, $vmd); } sub import_done_wait { # dwaitpid callback -- cgit v1.2.3-24-ge0c7