about summary refs log tree commit homepage
path: root/lib/PublicInbox/WwwAtomStream.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-07-07 20:37:38 +0000
committerEric Wong <e@yhbt.net>2020-07-10 11:27:09 +0000
commit7a8dfc760da33a5c4437a96783ed2e4e84f1fe1c (patch)
tree2c938789e18f60988eef0d35fe78183b485f0b0e /lib/PublicInbox/WwwAtomStream.pm
parent42a6fc1794099cb2585d3c290e42a20d5ef56b89 (diff)
downloadpublic-inbox-7a8dfc760da33a5c4437a96783ed2e4e84f1fe1c.tar.gz
As in Import, we'll fall back to Sender: if From: is missing,
and use the primary_address of the inboxes to indicate the total
absence of those fields.
Diffstat (limited to 'lib/PublicInbox/WwwAtomStream.pm')
-rw-r--r--lib/PublicInbox/WwwAtomStream.pm13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm
index 3b5b133a..2f9b953b 100644
--- a/lib/PublicInbox/WwwAtomStream.pm
+++ b/lib/PublicInbox/WwwAtomStream.pm
@@ -136,16 +136,13 @@ sub feed_entry {
         $title = '(no subject)' unless defined $title && $title ne '';
         $title = title_tag($title);
 
-        my $from = $hdr->header('From') or return;
+        my $from = $hdr->header('From') // $hdr->header('Sender') //
+                $ctx->{-inbox}->{-primary_address};
         my ($email) = PublicInbox::Address::emails($from);
-        my $name = join(', ',PublicInbox::Address::names($from));
-        $name = ascii_html($name);
-        $email = ascii_html($email);
+        my $name = ascii_html(join(', ', PublicInbox::Address::names($from)));
+        $email = ascii_html($email // $ctx->{-inbox}->{-primary_address});
 
-        my $s = '';
-        if (delete $ctx->{emit_header}) {
-                $s .= atom_header($ctx, $title);
-        }
+        my $s = delete($ctx->{emit_header}) ? atom_header($ctx, $title) : '';
         $s .= "<entry><author><name>$name</name><email>$email</email>" .
                 "</author>$title$updated" .
                 qq(<link\nhref="$href"/>).