From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E95811F55F for ; Fri, 8 Sep 2023 21:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1694209370; bh=YeQ33ySo9Y6kJvt6TEAcDzVQCXwkuUcXbHjGGF3Tg+8=; h=From:To:Subject:Date:From; b=bEKkZ/bnPo/DCCLDhi9ahvzxuFuW+z0JGZssPfk7LIYe7T1UiMhIEhr8a6IVw0mIX 0mc7D4UEEROLyBE9kt6qJGx7C+pQxFGXg3dptsZAqBhDI3YorgcZCb/ofDrZEYbBpt 543yH+yHaIGbUS/BGmK2pTisX1FuZQ8lKoYzY9Sk= From: Eric Wong To: spew@80x24.org Subject: [PATCH] imapd: lazy-load IMAPsearchqp for Parse::RecDescent Date: Fri, 8 Sep 2023 21:40:56 +0000 Message-ID: <20230908214056.54060-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This enables the t/pop3d.t test to pass when Parse::RecDescent is not available. --- lib/PublicInbox/IMAP.pm | 2 +- lib/PublicInbox/IMAPD.pm | 1 + t/pop3d.t | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 00f99ef7..3c64cefa 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -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; diff --git a/lib/PublicInbox/IMAPD.pm b/lib/PublicInbox/IMAPD.pm index 78323e57..bdadb7a3 100644 --- a/lib/PublicInbox/IMAPD.pm +++ b/lib/PublicInbox/IMAPD.pm @@ -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 } // {}; diff --git a/t/pop3d.t b/t/pop3d.t index dc52b0cf..001ceda8 100644 --- 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;