]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiLsMailSource.pm
No ext_urls
[public-inbox.git] / lib / PublicInbox / LeiLsMailSource.pm
index 2265969a0d9631709de2dba2548e7ef0080188c4..50799270a8de20959381544e3d01495cb5fd3707 100644 (file)
@@ -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;
 }