From 90155b72ccd38d51415f12547e39c4d65c469fe1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 29 Apr 2021 09:46:19 +0000 Subject: lei import: support UIDVALIDITY in IMAP URL Specifying a UIDVALIDITY value allows the user to enforce a strict match and force failure. This necessitated changes to NetReader to allow die() and make error reporting more suitable for CLI usage rather than daemonized usage of -watch. --- lib/PublicInbox/NetReader.pm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/PublicInbox/NetReader.pm') diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm index 81d25ead..3fc37b10 100644 --- a/lib/PublicInbox/NetReader.pm +++ b/lib/PublicInbox/NetReader.pm @@ -407,6 +407,11 @@ sub _imap_fetch_all ($$$) { return "E: $orig_uri cannot get UIDVALIDITY"; $r_uidnext //= $mic->uidnext($mbx) // return "E: $orig_uri cannot get UIDNEXT"; + my $expect = $orig_uri->uidvalidity // $r_uidval; + return <clone; my ($itrk, $l_uid, $l_uidval) = _itrk_last($self, $uri, $r_uidval); return <{-can_die}; warn $err if $err; $mic; } @@ -620,6 +626,7 @@ sub nntp_each { } else { $err = "E: <$uri> not connected: $!"; } + die $err if $err && $self->{-can_die}; warn $err if $err; $nn; } -- cgit v1.2.3-24-ge0c7