From: Eric Wong Date: Wed, 10 Jun 2020 07:04:18 +0000 (+0000) Subject: imap: support the CLOSE command X-Git-Tag: v1.6.0~446 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=1804e2961f3a28045b601a982f44ff61ea33a2fe imap: support the CLOSE command It seems worthless to support CLOSE for read-only inboxes, but mutt sends it, so don't return a BAD error with proper use. --- diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 54c616ee..0852ffab 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 1ec0d5c3..8172a919 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;