unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/3] imapd: lazy-load IMAPsearchqp for Parse::RecDescent
Date: Sat,  9 Sep 2023 01:48:37 +0000	[thread overview]
Message-ID: <20230909014838.1608889-3-e@80x24.org> (raw)
In-Reply-To: <20230909014838.1608889-1-e@80x24.org>

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;

  parent reply	other threads:[~2023-09-09  1:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-09  1:48 [PATCH 0/3] some portability and dependency fixes Eric Wong
2023-09-09  1:48 ` [PATCH 1/3] fix some tests when `curl' is missing Eric Wong
2023-09-09  1:48 ` Eric Wong [this message]
2023-09-09  1:48 ` [PATCH 3/3] pop3d: support fcntl locks on NetBSD and OpenBSD Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230909014838.1608889-3-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).