# large threads in our WWW UI and the NNTP range responses.
package PublicInbox::Smsg;
use strict;
-use warnings;
-use base qw(Exporter);
+use v5.10.1;
+use parent qw(Exporter);
our @EXPORT_OK = qw(subject_normalized);
use PublicInbox::MID qw(mids references);
use PublicInbox::Address;
use PublicInbox::MsgTime qw(msg_timestamp msg_datestamp);
+sub oidbin { pack('H*', $_[0]->{blob}) }
+
sub to_doc_data {
my ($self) = @_;
join("\n",
# to protect git and NNTP clients
$val =~ tr/\0\t\n/ /;
- # rare: in case headers have wide chars (not RFC2047-encoded)
- utf8::decode($val);
-
# lower-case fields for read-only stuff
$self->{lc($f)} = $val;
$self->{$f} = $val if $val ne '';
}
$sync //= {};
- $self->{-ds} = [ my @ds = msg_datestamp($hdr, $sync->{autime}) ];
- $self->{-ts} = [ my @ts = msg_timestamp($hdr, $sync->{cotime}) ];
+ my @ds = msg_datestamp($hdr, $sync->{autime} // $self->{ds});
+ my @ts = msg_timestamp($hdr, $sync->{cotime} // $self->{ts});
+ $self->{-ds} = \@ds;
+ $self->{-ts} = \@ts;
$self->{ds} //= $ds[0]; # no zone
$self->{ts} //= $ts[0];
$self->{mid} //= mids($hdr)->[0];