From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH 10/13] smsg: get rid of remaining {mime} users
Date: Mon, 1 Jun 2020 10:06:54 +0000 [thread overview]
Message-ID: <20200601100657.14700-11-e@yhbt.net> (raw)
In-Reply-To: <20200601100657.14700-1-e@yhbt.net>
We'll let $smsg->populate take care of everything all at once
without hanging onto the header object for too long.
---
lib/PublicInbox/OverIdx.pm | 1 -
lib/PublicInbox/Smsg.pm | 33 +++------------------------------
2 files changed, 3 insertions(+), 31 deletions(-)
diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm
index cb15baadf2b..a078f80451f 100644
--- a/lib/PublicInbox/OverIdx.pm
+++ b/lib/PublicInbox/OverIdx.pm
@@ -254,7 +254,6 @@ sub subject_path ($) {
sub add_overview {
my ($self, $mime, $smsg) = @_;
$smsg->{lines} = $mime->body_raw =~ tr!\n!\n!;
- $smsg->{mime} = $mime; # XXX temporary?
my $hdr = $mime->header_obj;
my $mids = mids_for_index($hdr);
my $refs = parse_references($smsg, $hdr, $mids);
diff --git a/lib/PublicInbox/Smsg.pm b/lib/PublicInbox/Smsg.pm
index 9688c5592a2..9e363a112c0 100644
--- a/lib/PublicInbox/Smsg.pm
+++ b/lib/PublicInbox/Smsg.pm
@@ -12,7 +12,7 @@ use strict;
use warnings;
use base qw(Exporter);
our @EXPORT_OK = qw(subject_normalized);
-use PublicInbox::MID qw(mid_mime mids);
+use PublicInbox::MID qw(mids);
use PublicInbox::Address;
use PublicInbox::MsgTime qw(msg_timestamp msg_datestamp);
use Time::Local qw(timegm);
@@ -96,13 +96,7 @@ sub lines ($) { $_[0]->{lines} }
sub __hdr ($$) {
my ($self, $field) = @_;
- $self->{lc($field)} //= do {
- my $mime = $self->{mime} or return;
- my $val = join(', ', $mime->header($field));
- $val =~ tr/\r//d;
- $val =~ tr/\t\n/ /;
- $val;
- };
+ $self->{lc($field)};
}
# for Import and v1 non-SQLite WWW code paths
@@ -174,34 +168,13 @@ sub from_name {
$self->{from_name};
}
-sub ts {
- my ($self) = @_;
- $self->{ts} ||= eval { msg_timestamp($self->{mime}->header_obj) } || 0;
-}
-
-sub ds {
- my ($self) = @_;
- $self->{ds} ||= eval { msg_datestamp($self->{mime}->header_obj); } || 0;
-}
-
sub references {
my ($self) = @_;
my $x = $self->{references};
defined $x ? $x : '';
}
-sub mid ($;$) {
- my ($self, $mid) = @_;
-
- if (defined $mid) {
- $self->{mid} = $mid;
- } elsif (defined(my $rv = $self->{mid})) {
- $rv;
- } else {
- die "NO {mime} for mid\n" unless $self->{mime};
- mid_mime($self->{mime}) # v1 w/o Xapian
- }
-}
+sub mid { $_[0]->{mid} }
our $REPLY_RE = qr/^re:\s+/i;
next prev parent reply other threads:[~2020-06-01 10:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-01 10:06 [PATCH 00/13] smsg: remove tricky {mime} field Eric Wong
2020-06-01 10:06 ` [PATCH 01/13] inbox: introduce smsg_eml method Eric Wong
2020-06-01 10:06 ` [PATCH 02/13] wwwatomstream: convert callers to use smsg_eml Eric Wong
2020-06-01 10:06 ` [PATCH 03/13] v2writable: fix non-sensical interpolation in BUG message Eric Wong
2020-06-01 10:06 ` [PATCH 04/13] import: modernize to use Perl 5.10 features Eric Wong
2020-06-01 10:06 ` [PATCH 05/13] smsg: introduce ->populate method Eric Wong
2020-06-01 10:06 ` [PATCH 06/13] smsg: get rid of ->wrap initializer, too Eric Wong
2020-06-01 10:06 ` [PATCH 07/13] inbox: msg_by_*: remove $(size)ref args Eric Wong
2020-06-01 10:06 ` [PATCH 08/13] www: remove smsg_mime API and adjust callers Eric Wong
2020-06-01 10:06 ` [PATCH 09/13] nntp: smsg_range_i: favor ->{$field} lookups when possible Eric Wong
2020-06-01 10:06 ` Eric Wong [this message]
2020-06-01 10:06 ` [PATCH 11/13] smsg: remove ->bytes and ->lines methods Eric Wong
2020-06-01 10:06 ` [PATCH 12/13] smsg: remove remaining accessor methods Eric Wong
2020-06-01 10:06 ` [PATCH 13/13] wwwatomstream: drop smsg->{mid} fallback for non-SQLite Eric Wong
2020-06-01 16:45 ` [PATCH 00/13] smsg: remove tricky {mime} field 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=20200601100657.14700-11-e@yhbt.net \
--to=e@yhbt.net \
--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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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).