about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-10 13:23:42 +0000
committerEric Wong <e@80x24.org>2021-03-10 23:39:15 -0400
commit2bc961811c57bef3feef24244bf20546f3754d4f (patch)
tree76966e65ca51d356987cc97236074cb241e7406f /lib
parented9ea6325f51165d8dd5a9c8361b4f58936a47d5 (diff)
downloadpublic-inbox-2bc961811c57bef3feef24244bf20546f3754d4f.tar.gz
This matches existing Maildir behavior, as trash and draft
messages have little reason to be exposed publicly.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/NetReader.pm2
-rw-r--r--lib/PublicInbox/Watch.pm26
2 files changed, 6 insertions, 22 deletions
diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm
index f5f71005..d3094fc7 100644
--- a/lib/PublicInbox/NetReader.pm
+++ b/lib/PublicInbox/NetReader.pm
@@ -349,6 +349,8 @@ sub _imap_do_msg ($$$$$) {
                 if (my $k = $IMAPflags2kw{$f}) {
                         push @$kw, $k;
                 } elsif ($f eq "\\Recent") { # not in JMAP
+                } elsif ($f eq "\\Deleted") { # not in JMAP
+                        return;
                 } elsif ($self->{verbose}) {
                         warn "# unknown IMAP flag $f <$uri;uid=$uid>\n";
                 }
diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index dd245935..4fbc9640 100644
--- a/lib/PublicInbox/Watch.pm
+++ b/lib/PublicInbox/Watch.pm
@@ -287,30 +287,9 @@ sub watch_fs_init ($) {
         PublicInbox::DirIdle->new([keys %{$self->{mdmap}}], $cb);
 }
 
-sub imap_import_msg ($$$$$) {
-        my ($self, $uri, $uid, $raw, $flags) = @_;
-        # our target audience expects LF-only, save storage
-        $$raw =~ s/\r\n/\n/sg;
-
-        my $inboxes = $self->{imap}->{$$uri};
-        if (ref($inboxes)) {
-                for my $ibx (@$inboxes) {
-                        my $eml = PublicInbox::Eml->new($$raw);
-                        import_eml($self, $ibx, $eml);
-                }
-        } elsif ($inboxes eq 'watchspam') {
-                return if $flags !~ /\\Seen\b/; # don't remove unseen messages
-                local $SIG{__WARN__} = PublicInbox::Eml::warn_ignore_cb();
-                my $eml = PublicInbox::Eml->new($raw);
-                $self->{pi_cfg}->each_inbox(\&remove_eml_i,
-                                                $self, $eml, "$uri UID:$uid");
-        } else {
-                die "BUG: destination unknown $inboxes";
-        }
-}
-
 sub net_cb { # NetReader::(nntp|imap)_each callback
         my ($uri, $art, $kw, $eml, $self, $inboxes) = @_;
+        return if grep(/\Adraft\z/, @$kw);
         local $self->{cur_uid} = $art; # IMAP UID or NNTP article
         if (ref($inboxes)) {
                 my @ibx = @$inboxes;
@@ -321,6 +300,9 @@ sub net_cb { # NetReader::(nntp|imap)_each callback
                 }
                 import_eml($self, $last, $eml);
         } elsif ($inboxes eq 'watchspam') {
+                if ($uri->scheme =~ /\Aimaps?\z/ && !grep(/\Aseen\z/, @$kw)) {
+                        return;
+                }
                 $self->{pi_cfg}->each_inbox(\&remove_eml_i,
                                 $self, $eml, "$uri #$art");
         } else {