X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FLeiLsMailSource.pm;h=50799270a8de20959381544e3d01495cb5fd3707;hb=23af251dd607c4e75ab1e68063f2c885c48cc035;hp=2265969a0d9631709de2dba2548e7ef0080188c4;hpb=7381166453ea76bef14403feb662d1e8bfccd209;p=public-inbox.git diff --git a/lib/PublicInbox/LeiLsMailSource.pm b/lib/PublicInbox/LeiLsMailSource.pm index 2265969a..50799270 100644 --- a/lib/PublicInbox/LeiLsMailSource.pm +++ b/lib/PublicInbox/LeiLsMailSource.pm @@ -95,24 +95,20 @@ sub lei_ls_mail_source { $json->pretty(1)->indent(2) if $isatty || $lei->{opt}->{pretty}; } $lei->start_pager if $isatty; - my $ops = {}; - $lei->{auth}->op_merge($ops, $self); - (my $op_c, $ops) = $lei->workers_start($self, 1, $ops); - $lei->{wq1} = $self; $lei->{-err_type} = 'non-fatal'; - net_merge_all_done($self) unless $lei->{auth}; - $lei->wait_wq_events($op_c, $ops); # net_merge_all_done if !{auth} + $lei->wq1_start($self); } sub _complete_ls_mail_source { my ($lei, @argv) = @_; my $match_cb = $lei->complete_url_prepare(\@argv); - my @m = map { $match_cb->($_) } $lei->url_folder_cache->keys; - my %f = map { $_ => 1 } @m; + my @k = $lei->url_folder_cache->keys($argv[-1] // undef, 1); + my @m = map { $match_cb->($_) } @k; + my %f = map { $_ => 1 } (@m ? @m : @k); if (my $lms = $lei->lms) { - @m = map { $match_cb->($_) } grep( - m!\A(?:imaps?|nntps?|s?news)://!, $lms->folders); - @f{@m} = @m; + @k = $lms->folders($argv[-1] // undef, 1); + @m = map { $match_cb->($_) } grep(m!\A[a-z]+://!, @k); + if (@m) { @f{@m} = @m } else { @f{@k} = @k } } keys %f; }