- my $midurl = $feed_opts->{midurl} || 'http://example.com/mid/';
- my $fullurl = $feed_opts->{fullurl} || 'http://example.com/full/';
-
- my $content = PublicInbox::View->as_feed_entry($mime, $fullurl);
- defined($content) or return 0;
-
- my $mid = utf8_header($mime, "Message-ID") or return 0;
- $mid =~ s/\A<//;
- $mid =~ s/>\z//;
-
- my $subject = utf8_header($mime, "Subject") || "";
- defined($subject) && length($subject) or return 0;
-
- my $from = utf8_header($mime, "From") or return 0;
-
- my @from = Email::Address->parse($from);
- my $name = $from[0]->name;
- defined $name or $name = "";
- my $email = $from[0]->address;
- defined $email or $email = "";
-
- my $url = $midurl . uri_escape($mid);
- my $date = utf8_header($mime, "Date");
- $date or return 0;
- $date = feed_date($date) or return 0;
- $feed->add_entry(
- author => { name => $name, email => $email },
- title => $subject,
- updated => $date,
- content => { type => "html", content => $content },
- link => $url,
- id => $add,
- );
- 1;