From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id B94841FBFF for ; Wed, 10 Jun 2020 07:07:31 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 66/82] imap: rely on smsg->{bytes} for RFC822.SIZE Date: Wed, 10 Jun 2020 07:05:03 +0000 Message-Id: <20200610070519.18252-67-e@yhbt.net> In-Reply-To: <20200610070519.18252-1-e@yhbt.net> References: <20200610070519.18252-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Since we started indexing the CRLF-adjusted size of messages, we can take an order-of-magnitude speedup for certain MUAs which fetch this attribute without needing much else. Admins are encouraged to --reindex existing inboxes for IMAP support, anyways. It won't be fatal if it's not reindexed, but some client bugs and warnings can be fixed and they'll be able to support more of IMAP. --- lib/PublicInbox/IMAP.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 803ce31ff22..9cdcba693c7 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -53,7 +53,7 @@ my %FETCH_NEED = ( 'BODY[]' => [ NEED_BLOB, \&emit_rfc822 ], 'RFC822.HEADER' => [ NEED_EML, \&emit_rfc822_header ], 'RFC822.TEXT' => [ NEED_EML, \&emit_rfc822_text ], - 'RFC822.SIZE' => [ NEED_BLOB, \&emit_rfc822_size ], + 'RFC822.SIZE' => [ NEED_SMSG, \&emit_rfc822_size ], RFC822 => [ NEED_BLOB, \&emit_rfc822 ], BODY => [ NEED_EML, \&emit_body ], BODYSTRUCTURE => [ NEED_EML, \&emit_bodystructure ], @@ -500,11 +500,12 @@ sub emit_rfc822 { $self->msg_more($$bref); } -# Mail::IMAPClient::message_string cares about this by default -# (->Ignoresizeerrors attribute) +# Mail::IMAPClient::message_string cares about this by default, +# (->Ignoresizeerrors attribute). Admins are encouraged to +# --reindex for IMAP support, anyways. sub emit_rfc822_size { - my ($self, $k, undef, $bref) = @_; - $self->msg_more(' RFC822.SIZE ' . length($$bref)); + my ($self, $k, $smsg) = @_; + $self->msg_more(' RFC822.SIZE ' . $smsg->{bytes}); } sub emit_internaldate {