-sub generate_html_index {
- my ($class, $args) = @_;
- my $max = $args->{max} || 50;
- my $top = $args->{top}; # bool
- local $ENV{GIT_DIR} = $args->{git_dir};
- my $feed_opts = get_feedopts($args);
- my $title = escapeHTML($feed_opts->{description} || "");
- my @messages;
- each_recent_blob($max, sub {
- my $str = `git cat-file blob $_[0]`;
- return 0 if $? != 0;
- my $simple = Email::Simple->new($str);
- if ($top && ($simple->header("In-Reply-To") ||
- $simple->header("References"))) {
- return 0;
- }
- $simple->body_set(""); # save some memory
- push @messages, $simple;
- 1;
- });
-
- my $th = Mail::Thread->new(@messages);
- $th->thread;
- my @args = (
- "<html><head><title>$title</title>" .
- '<link rel=alternate title=Atom.feed href="' .
- $feed_opts->{atomurl} . '" type="application/atom+xml"/>' .
- '</head><body><pre>');
- push @args, $feed_opts->{midurl};
- dump_html_line($_, 0, \@args) for $th->rootset;
- $args[0] . '</pre></html>';
+sub generate_thread_atom {
+ my ($ctx) = @_;
+ my $msgs = $ctx->{msgs} = $ctx->{-inbox}->over->get_thread($ctx->{mid});
+ return _no_thread() unless @$msgs;
+ PublicInbox::WwwAtomStream->response($ctx, 200, \&generate_i);