X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FSmsg.pm;h=571cbb6faca9417d804b1771b0bb94fdac5e6987;hb=af0b0fb7a454470a32c452119d0392e0dedb3fe1;hp=0a0384efaadf7811d372631885ec771345370c7b;hpb=ae546078c5696ac73ad9f48c2c90163febb4a246;p=public-inbox.git diff --git a/lib/PublicInbox/Smsg.pm b/lib/PublicInbox/Smsg.pm index 0a0384ef..571cbb6f 100644 --- a/lib/PublicInbox/Smsg.pm +++ b/lib/PublicInbox/Smsg.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2020 all contributors +# Copyright (C) 2015-2021 all contributors # License: AGPL-3.0+ # # A small/skeleton/slim representation of a message. @@ -15,13 +15,6 @@ our @EXPORT_OK = qw(subject_normalized); use PublicInbox::MID qw(mids); use PublicInbox::Address; use PublicInbox::MsgTime qw(msg_timestamp msg_datestamp); -use Time::Local qw(timegm); - -sub get_val ($$) { - my ($doc, $col) = @_; - # sortable_unserialise is defined by PublicInbox::Search::load_xapian() - sortable_unserialise($doc->get_value($col)); -} sub to_doc_data { my ($self) = @_; @@ -61,17 +54,6 @@ sub load_from_data ($$) { ) = split(/\n/, $_[1]); } -sub load_expand { - my ($self, $doc) = @_; - my $data = $doc->get_data or return; - $self->{ts} = get_val($doc, PublicInbox::Search::TS()); - my $dt = get_val($doc, PublicInbox::Search::DT()); - my ($yyyy, $mon, $dd, $hh, $mm, $ss) = unpack('A4A2A2A2A2A2', $dt); - $self->{ds} = timegm($ss, $mm, $hh, $dd, $mon - 1, $yyyy); - load_from_data($self, $data); - $self; -} - sub psgi_cull ($) { my ($self) = @_; @@ -83,11 +65,11 @@ sub psgi_cull ($) { # drop NNTP-only fields which aren't relevant to PSGI results: # saves ~80K on a 200 item search result: # TODO: we may need to keep some of these for JMAP... - delete @$self{qw(ts tid to cc bytes lines)}; + delete @$self{qw(tid to cc bytes lines)}; $self; } -# for Import and v1 non-SQLite WWW code paths +# used for v2, Import and v1 non-SQLite WWW code paths sub populate { my ($self, $hdr, $sync) = @_; for my $f (qw(From To Cc Subject)) { @@ -118,9 +100,7 @@ sub populate { $self->{-ts} = [ my @ts = msg_timestamp($hdr, $sync->{cotime}) ]; $self->{ds} //= $ds[0]; # no zone $self->{ts} //= $ts[0]; - - # for v1 users w/o SQLite - $self->{mid} //= eval { mids($hdr)->[0] } // ''; + $self->{mid} //= mids($hdr)->[0]; } # no strftime, that is locale-dependent and not for RFC822