It seems worthless to support CLOSE for read-only inboxes, but
mutt sends it, so don't return a BAD error with proper use.
---
 lib/PublicInbox/IMAP.pm | 6 ++++++
 t/imapd.t               | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm
index 54c616eee2f..0852ffab868 100644
--- a/lib/PublicInbox/IMAP.pm
+++ b/lib/PublicInbox/IMAP.pm
@@ -121,6 +121,12 @@ sub cmd_login ($$$$) {
        login_success($self, $tag);
 }
 
+sub cmd_close ($$) {
+       my ($self, $tag) = @_;
+       delete $self->{ibx} ? "$tag OK Close done\r\n"
+                               : "$tag BAD No mailbox\r\n";
+}
+
 sub cmd_logout ($$) {
        my ($self, $tag) = @_;
        delete $self->{logged_in};
diff --git a/t/imapd.t b/t/imapd.t
index 1ec0d5c370f..8172a91923d 100644
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -327,7 +327,8 @@ $r2 = $mic->fetch_hash(2, 'BODY.PEEK[HEADER.FIELDS 
(message-id)]')
 is($r2->{2}->{'BODY[HEADER.FIELDS (MESSAGE-ID)]'},
        'Message-ID: <20200418222508.GA13918@dcvr>'."\r\n\r\n",
        'BODY.PEEK[HEADER.FIELDS ...] drops .PEEK');
-
+ok($mic->close, 'CLOSE works');
+ok(!$mic->close, 'CLOSE not idempotent');
 ok($mic->logout, 'logged out');
 
 $td->kill;
--
unsubscribe: one-click, see List-Unsubscribe header
archive: https://public-inbox.org/meta/

Reply via email to