about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiQuery.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-02-21 07:41:29 +0000
committerEric Wong <e@80x24.org>2021-02-21 08:59:29 +0000
commitfb8b16ff2b40ecd22ebbdea0d27069749e800077 (patch)
treeed51c13c4d349b5375ea414ee2432f82ffd0b83f /lib/PublicInbox/LeiQuery.pm
parent54e53bfb66c325cc838a44ed3a19042b6dfcdf02 (diff)
downloadpublic-inbox-fb8b16ff2b40ecd22ebbdea0d27069749e800077.tar.gz
Augment (and dedupe) aren't parallel, yet, so its more sensitive to
high-latency networks.
Diffstat (limited to 'lib/PublicInbox/LeiQuery.pm')
-rw-r--r--lib/PublicInbox/LeiQuery.pm18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm
index f71beae6..eaf91f2e 100644
--- a/lib/PublicInbox/LeiQuery.pm
+++ b/lib/PublicInbox/LeiQuery.pm
@@ -11,14 +11,26 @@ sub prep_ext { # externals_each callback
         $lxs->prepare_external($loc) unless $exclude->{$loc};
 }
 
-sub qstr_add { # for --stdin
+sub _start_query {
+        my ($self) = @_;
+        if (my $nwr = $self->{nwr}) {
+                require PublicInbox::LeiAuth;
+                my $auth = $self->{auth} = PublicInbox::LeiAuth->new($nwr);
+                my $lxs = $self->{lxs};
+                $auth->auth_start($self, $lxs->can('do_query'), $lxs, $self);
+        } else {
+                $self->{lxs}->do_query($self);
+        }
+}
+
+sub qstr_add { # PublicInbox::InputPipe::consume callback for --stdin
         my ($self) = @_; # $_[1] = $rbuf
         if (defined($_[1])) {
                 $_[1] eq '' and return eval {
                         my $lse = delete $self->{lse};
                         $lse->query_approxidate($lse->git,
                                                 $self->{mset_opt}->{qstr});
-                        $self->{lxs}->do_query($self);
+                        _start_query($self);
                 };
                 $self->{mset_opt}->{qstr} .= $_[1];
         } else {
@@ -115,7 +127,7 @@ no query allowed on command-line with --stdin
                 return;
         }
         $mset_opt{qstr} = $lse->query_argv_to_string($lse->git, \@argv);
-        $lxs->do_query($self);
+        _start_query($self);
 }
 
 # shell completion helper called by lei__complete