]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/NetWriter.pm
lei q: support IMAP/IMAPS --output destinations
[public-inbox.git] / lib / PublicInbox / NetWriter.pm
index 6f0a0b94e7527b81429e7bc4ff3723d6666b1d62..89f8662efa647009ce68778e94c95c2d94a1e7ff 100644 (file)
@@ -23,4 +23,16 @@ sub imap_append {
                die "APPEND $folder: $@";
 }
 
+sub imap_delete_all {
+       my ($self, $url) = @_;
+       my $uri = PublicInbox::URIimap->new($url);
+       my $sec = $self->can('uri_section')->($uri);
+       local $0 = $uri->mailbox." $sec";
+       my $mic = $self->mic_get($sec) or die "E: not connected: $@";
+       $mic->select($uri->mailbox) or return; # non-existent
+       if ($mic->delete_message('1:*')) {
+               $mic->expunge;
+       }
+}
+
 1;