about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-13 22:35:47 +0000
committerEric Wong <e@80x24.org>2015-09-13 22:36:17 +0000
commit0bd1fb36dded212c6f388599347501e2ca6b201b (patch)
tree60206fd14713c0fd250530e3988f4848c4e56ec2 /lib
parentd6089bc6728e6dc03640b312f097fe8328e8992e (diff)
downloadpublic-inbox-0bd1fb36dded212c6f388599347501e2ca6b201b.tar.gz
Some user agents will advertise the presence of a feed this
way for users to subscribe to individual topics.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/View.pm15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index de2d667c..7e1fb045 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -432,15 +432,19 @@ sub headers_to_html_header {
         $rv .= 'Message-ID: &lt;' . $mid->as_html . '&gt; ';
         my $upfx = $full_pfx ? '' : '../';
         $rv .= "(<a\nhref=\"${upfx}raw\">raw</a>)\n";
+        my $atom;
         if ($srch) {
                 $rv .= "<a\nhref=\"${upfx}t/\">References: [expand]</a>\n";
+                $atom = qq{<link\nrel=alternate\ntitle="Atom feed"\n} .
+                        qq!href="${upfx}t.atom"\ntype="application/atom+xml"/>!;
         } else {
                 $rv .= _parent_headers_nosrch($header_obj);
+                $atom = '';
         }
         $rv .= "\n";
 
         ("<html><head><title>".  join(' - ', @title) .
-         '</title></head><body>' . PRE_WRAP . $rv);
+         "</title>$atom</head><body>" . PRE_WRAP . $rv);
 }
 
 sub thread_inline {
@@ -578,12 +582,15 @@ sub anchor_for {
 }
 
 sub thread_html_head {
-        my ($cb, $mime) = @_;
+        my ($cb, $header, $state) = @_;
         $$cb = $$cb->([200, ['Content-Type'=> 'text/html; charset=UTF-8']]);
 
-        my $s = PublicInbox::Hval->new_oneline($mime->header('Subject'));
+        my $s = PublicInbox::Hval->new_oneline($header->header('Subject'));
         $s = $s->as_html;
-        $$cb->write("<html><head><title>$s</title></head><body>");
+        $$cb->write("<html><head><title>$s</title>".
+                qq{<link\nrel=alternate\ntitle="Atom feed"\n} .
+                qq!href="../t.atom"\ntype="application/atom+xml"/>! .
+                "</head><body>");
 }
 
 sub pre_anchor_entry {