]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiSavedSearch.pm
imap: quiet Parse::RecDescent errors on bad search queries
[public-inbox.git] / lib / PublicInbox / LeiSavedSearch.pm
index b2f1ad1027d3a3a53a652b3abb65dc78df23c1b5..e53963420edde6f2e36665855c6c57781a822448 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # pretends to be like LeiDedupe and also PublicInbox::Inbox
@@ -13,7 +13,7 @@ use PublicInbox::Config;
 use PublicInbox::Spawn qw(run_die);
 use PublicInbox::ContentHash qw(git_sha);
 use PublicInbox::MID qw(mids_for_index);
-use Digest::SHA qw(sha256_hex);
+use PublicInbox::SHA qw(sha256_hex);
 our $LOCAL_PFX = qr!\A(?:maildir|mh|mbox.+|mmdf|v2):!i; # TODO: put in LeiToMail?
 
 # move this to PublicInbox::Config if other things use it:
@@ -21,6 +21,7 @@ my %cquote = ("\n" => '\\n', "\t" => '\\t', "\b" => '\\b');
 sub cquote_val ($) { # cf. git-config(1)
        my ($val) = @_;
        $val =~ s/([\n\t\b])/$cquote{$1}/g;
+       $val =~ s/\"/\\\"/g;
        $val;
 }
 
@@ -162,6 +163,10 @@ EOM
                my $val = $lei->{opt}->{$k} // next;
                print $fh "\t$k = $val\n";
        }
+       $lei->{opt}->{stdin} and print $fh <<EOM;
+[lei "internal"]
+       rawstr = 1 # stdin was used initially
+EOM
        close($fh) or return $lei->fail("close $f: $!");
        $self->{lock_path} = "$self->{-f}.flock";
        $self->{-ovf} = "$dir/over.sqlite3";
@@ -294,7 +299,6 @@ no warnings 'once';
 *smsg_by_mid = \&PublicInbox::Inbox::smsg_by_mid;
 *msg_by_mid = \&PublicInbox::Inbox::msg_by_mid;
 *modified = \&PublicInbox::Inbox::modified;
-*recent = \&PublicInbox::Inbox::recent;
 *max_git_epoch = *nntp_usable = *msg_by_path = \&mm; # undef
 *isrch = *search = \&mm; # TODO
 *DESTROY = \&pause_dedupe;