sub msg_by_smsg ($$;$) {
my ($self, $smsg, $ref) = @_;
- return unless defined $smsg; # ghost
-
- # backwards compat to fallback to msg_by_mid
- # TODO: remove if we bump SCHEMA_VERSION in Search.pm:
- defined(my $blob = $smsg->{blob}) or
- return msg_by_path($self, mid2path($smsg->mid), $ref);
+ # ghosts may have undef smsg (from SearchThread.node) or
+ # no {blob} field (from each_smsg_by_mid)
+ return unless defined $smsg;
+ defined(my $blob = $smsg->{blob}) or return;
my $str = git($self)->cat_file($blob, $ref);
$$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s if $str;
}
for (; !defined($cur) && $head != $tail; $head++) {
my $smsg = PublicInbox::SearchMsg->get($head, $db, $ctx->{mid});
- next if $smsg->type ne 'mail';
my $mref = $ctx->{-inbox}->msg_by_smsg($smsg) or next;
$cur = Email::Simple->new($mref);
$cur = msg_str($ctx, $cur);
for (; !defined($first) && $head != $tail; $head++) {
my @args = ($head, $db, $mid);
my $smsg = PublicInbox::SearchMsg->get(@args);
- next if $smsg->type ne 'mail';
my $mref = $ibx->msg_by_smsg($smsg) or next;
$first = Email::Simple->new($mref);
}
for (; !defined($first) && $head != $tail; $head++) {
my @args = ($head, $db, $mid);
my $smsg = PublicInbox::SearchMsg->get(@args);
- next if $smsg->type ne 'mail';
$first = $ibx->msg_by_smsg($smsg);
}
if ($head != $tail) {
my $mid = $ctx->{mid};
for (; !defined($smsg) && $head != $tail; $head++) {
my $m = PublicInbox::SearchMsg->get($head, $db, $mid);
- next if $m->type ne 'mail';
$smsg = $ctx->{-inbox}->smsg_mime($m);
}
if ($head == $tail) { # done