diff options
author | Eric Wong <e@80x24.org> | 2021-06-09 07:47:51 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-06-09 10:03:45 +0000 |
commit | 84cc78416994832973c44aab08814b43a0fe7e51 (patch) | |
tree | b950b8db0e54aff32b5e9bbf89b782ac7ab5e27a /lib/PublicInbox/NetReader.pm | |
parent | 9048ddfeb4df5cd3a4a8373de48c7137aed55b29 (diff) | |
download | public-inbox-84cc78416994832973c44aab08814b43a0fe7e51.tar.gz |
This will be invoked automatically by "lei import" eventually, but it may make sense to expose as a separate command.
Diffstat (limited to 'lib/PublicInbox/NetReader.pm')
-rw-r--r-- | lib/PublicInbox/NetReader.pm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm index 058f4313..2795a9d4 100644 --- a/lib/PublicInbox/NetReader.pm +++ b/lib/PublicInbox/NetReader.pm @@ -747,4 +747,23 @@ sub nntp_each { sub new { bless {}, shift }; +# updates $uri with UIDVALIDITY +sub mic_for_folder { + my ($self, $uri) = @_; + my $mic = $self->mic_get($uri) or die "E: not connected: $@"; + my $m = $self->isa('PublicInbox::NetWriter') ? 'select' : 'examine'; + $mic->$m($uri->mailbox) or return; + my $uidval; + for ($mic->Results) { + /^\* OK \[UIDVALIDITY ([0-9]+)\].*/ or next; + $uidval = $1; + last; + } + $uidval //= $mic->uidvalidity($uri->mailbox) or + die "E: failed to get uidvalidity from <$uri>: $@"; + $uri->uidvalidity($uidval); + $mic; +} + + 1; |