- $ctx->{feed_base_url} = $ctx->{-inbox}->base_url($ctx->{env});
- bless { cb => $cb || \&close, ctx => $ctx, emit_header => 1 }, $class;
+ $ctx->{feed_base_url} = $ctx->{ibx}->base_url($ctx->{env});
+ $ctx->{-spfx} = $ctx->{feed_base_url} if $ctx->{ibx}->{coderepo};
+ $ctx->{cb} = $cb || \&PublicInbox::GzipFilter::close;
+ $ctx->{emit_header} = 1;
+ bless $ctx, $class;
+}
+
+sub async_next ($) {
+ my ($http) = @_; # PublicInbox::HTTP
+ my $ctx = $http->{forward} or return;
+ eval {
+ if (my $smsg = $ctx->{smsg} = $ctx->{cb}->($ctx)) {
+ $ctx->smsg_blob($smsg);
+ } else {
+ $ctx->write('</feed>');
+ $ctx->close;
+ }
+ };
+ warn "E: $@" if $@;
+}
+
+sub async_eml { # for async_blob_cb
+ my ($ctx, $eml) = @_;
+ my $smsg = delete $ctx->{smsg};
+ $smsg->{mid} // $smsg->populate($eml);
+ $ctx->write(feed_entry($ctx, $smsg, $eml));