]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
imapd: lazy-load IMAPsearchqp for Parse::RecDescent
authorEric Wong <e@80x24.org>
Sat, 9 Sep 2023 01:48:37 +0000 (01:48 +0000)
committerEric Wong <e@80x24.org>
Sat, 9 Sep 2023 11:54:30 +0000 (11:54 +0000)
This enables the t/pop3d.t test to pass when Parse::RecDescent
is not available.

lib/PublicInbox/IMAP.pm
lib/PublicInbox/IMAPD.pm
t/pop3d.t

index 00f99ef75926a707148bc5c8548458c011c11cc9..3c64cefa4253d03491461e28eff30e49efbc9919 100644 (file)
@@ -39,7 +39,6 @@ use PublicInbox::DS qw(now);
 use PublicInbox::GitAsyncCat;
 use Text::ParseWords qw(parse_line);
 use Errno qw(EAGAIN);
-use PublicInbox::IMAPsearchqp;
 
 my $Address;
 for my $mod (qw(Email::Address::XS Mail::Address)) {
@@ -1088,6 +1087,7 @@ sub search_uid_range { # long_response
 
 sub parse_imap_query ($$) {
        my ($self, $query) = @_;
+       # IMAPsearchqp gets loaded in IMAPD->refresh_groups
        my $q = PublicInbox::IMAPsearchqp::parse($self, $query);
        if (ref($q)) {
                my $max = $self->{ibx}->over(1)->max;
index 78323e57c851ac664120109f9eb4c0a1ee9b85e9..bdadb7a35ef9275855842bc69e7ffce9194c081b 100644 (file)
@@ -55,6 +55,7 @@ sub _refresh_ibx { # pi_cfg->each_inbox cb
 sub refresh_groups {
        my ($self, $sig) = @_;
        my $pi_cfg = PublicInbox::Config->new;
+       require PublicInbox::IMAPsearchqp;
        $self->{mailboxes} = $pi_cfg->{-imap_mailboxes} // do {
                my $mailboxes = $self->{mailboxes} = {};
                my $cache = eval { $pi_cfg->ALL->misc->nntpd_cache_load } // {};
index dc52b0cf84117ab15d81106896ea4d4f5f27d042..001ceda889985e0fd843d15673f936d59aaae7a4 100644 (file)
--- a/t/pop3d.t
+++ b/t/pop3d.t
@@ -276,7 +276,7 @@ EOF
                like($x, qr/\Adataready\0+\z/, 'got dataready accf for pop3s');
                $x = getsockopt($stls, IPPROTO_TCP,
                                $PublicInbox::Daemon::SO_ACCEPTFILTER);
-               is($x, undef, 'no BSD accept filter for plain IMAP');
+               is($x, undef, 'no BSD accept filter for plain POP3');
        };
 
        $td->kill;