From a9bfba8eb31dbb4cdb8306496a911a84f8ac6e04 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 23 May 2021 21:36:50 +0000 Subject: lei inspect: use LeiMailSync->match_imap_url Move match_imap_url into LeiMailSync so it can be used in more places, such as "lei inspect". Upcoming commands such as "lei forget-mail-sync" and {add,forget,pause,resume}-watch will also support relaxed IMAP matching rules since there's no reasonable way to expect users use ";UIDVALIDITY=" on the command-line. --- lib/PublicInbox/LeiInspect.pm | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'lib/PublicInbox/LeiInspect.pm') diff --git a/lib/PublicInbox/LeiInspect.pm b/lib/PublicInbox/LeiInspect.pm index f79ebc9a..7fd33289 100644 --- a/lib/PublicInbox/LeiInspect.pm +++ b/lib/PublicInbox/LeiInspect.pm @@ -31,18 +31,7 @@ sub inspect_sync_folder ($$) { my $lms = $lse->lms or return $ent; my @folders; if ($folder =~ m!\Aimaps?://!i) { - require PublicInbox::URIimap; - my $uri = PublicInbox::URIimap->new($folder)->canonical; - if (defined($uri->uidvalidity)) { - $folders[0] = $$uri; - } else { - my @maybe = $lms->folders($$uri); - @folders = grep { - my $u = PublicInbox::URIimap->new($_); - $uri->uidvalidity($u->uidvalidity); - $$uri eq $$u; - } @maybe; - } + @folders = map { $_->as_string } $lms->match_imap_url($folder); } elsif ($folder =~ m!\A(maildir|mh):(.+)!i) { my $type = lc $1; $folders[0] = "$type:".$lei->abs_path($2); -- cgit v1.2.3-24-ge0c7