From 4723390cc4bb76762a9d60feecb66482caaef6a7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 1 Jun 2020 10:06:54 +0000 Subject: smsg: get rid of remaining {mime} users 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(-) (limited to 'lib') diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm index cb15baad..a078f804 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 9688c559..9e363a11 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; -- cgit v1.2.3-24-ge0c7