]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add SUP links to RSS and Atom, too
authorEvan Prodromou <evan@controlyourself.ca>
Sun, 26 Oct 2008 14:53:26 +0000 (10:53 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Sun, 26 Oct 2008 14:53:26 +0000 (10:53 -0400)
darcs-hash:20081026145326-5ed1f-430b98eedef21903caaae47e3355482ae7bfa616.gz

actions/twitapistatuses.php
lib/twitterapi.php

index 5459db8a012b95c355f65853acd9f7ea0f428575..a33e8cc3b326202789235e75c23b968e7b3e00af 100644 (file)
@@ -191,6 +191,12 @@ class TwitapistatusesAction extends TwitterapiAction {
                $link = common_local_url('showstream', array('nickname' => $user->nickname));
                $subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
 
+               # FriendFeed's SUP protocol
+               # Also added RSS and Atom feeds
+               
+               $suplink = common_local_url('sup', NULL, $user->id);
+               header('X-SUP-ID: '.$suplink);
+               
                # XXX: since
 
                $notice = $user->getNotices((($page-1)*20), $count, $since_id, $before_id);
@@ -200,10 +206,10 @@ class TwitapistatusesAction extends TwitterapiAction {
                        $this->show_xml_timeline($notice);
                        break;
                 case 'rss':
-                       $this->show_rss_timeline($notice, $title, $id, $link, $subtitle);
+                       $this->show_rss_timeline($notice, $title, $id, $link, $subtitle, $suplink);
                        break;
                 case 'atom':
-                       $this->show_atom_timeline($notice, $title, $id, $link, $subtitle);
+                       $this->show_atom_timeline($notice, $title, $id, $link, $subtitle, $suplink);
                        break;
                 case 'json':
                        $this->show_json_timeline($notice);
index 734fc49079d6c46e9d209901c612d2fa7afda7d9..d4b6fff4fb47f7bacaa153d87ed962dd5eb0aca2 100644 (file)
@@ -259,13 +259,20 @@ class TwitterapiAction extends Action {
                $this->end_document('xml');
        }
 
-       function show_rss_timeline($notice, $title, $link, $subtitle) {
+       function show_rss_timeline($notice, $title, $link, $subtitle, $suplink=NULL) {
 
                $this->init_document('rss');
 
                common_element_start('channel');
                common_element('title', NULL, $title);
                common_element('link', NULL, $link);
+               if (!is_null($suplink)) {
+                       # For FriendFeed's SUP protocol
+                       common_element('link', array('xmlns' => 'http://www.w3.org/2005/Atom',
+                                                                                'rel' => 'http://api.friendfeed.com/2008/03#sup',
+                                                                                'href' => $suplink,
+                                                                                'type' => 'application/json'));
+               }
                common_element('description', NULL, $subtitle);
                common_element('language', NULL, 'en-us');
                common_element('ttl', NULL, '40');
@@ -287,13 +294,19 @@ class TwitterapiAction extends Action {
                $this->end_twitter_rss();
        }
 
-       function show_atom_timeline($notice, $title, $id, $link, $subtitle=NULL) {
+       function show_atom_timeline($notice, $title, $id, $link, $subtitle=NULL, $suplink=NULL) {
 
                $this->init_document('atom');
 
                common_element('title', NULL, $title);
                common_element('id', NULL, $id);
                common_element('link', array('href' => $link, 'rel' => 'alternate', 'type' => 'text/html'), NULL);
+               if (!is_null($suplink)) {
+                       # For FriendFeed's SUP protocol
+                       common_element('link', array('rel' => 'http://api.friendfeed.com/2008/03#sup',
+                                                                                'href' => $suplink,
+                                                                                'type' => 'application/json'));
+               }
                common_element('subtitle', NULL, $subtitle);
 
                if (is_array($notice)) {