summaryrefslogtreecommitdiff
path: root/actions/apitimelineuser.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/apitimelineuser.php')
-rw-r--r--actions/apitimelineuser.php62
1 files changed, 52 insertions, 10 deletions
diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php
index 830b16941..3e849cc78 100644
--- a/actions/apitimelineuser.php
+++ b/actions/apitimelineuser.php
@@ -116,7 +116,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
$sitename = common_config('site', 'name');
$title = sprintf(_("%s timeline"), $this->user->nickname);
- $taguribase = common_config('integration', 'taguri');
+ $taguribase = TagURI::base();
$id = "tag:$taguribase:UserTimeline:" . $this->user->id;
$link = common_local_url(
'showstream',
@@ -145,18 +145,60 @@ class ApiTimelineUserAction extends ApiBareAuthAction
);
break;
case 'atom':
- if (isset($apidata['api_arg'])) {
- $selfuri = common_root_url() .
- 'api/statuses/user_timeline/' .
- $apidata['api_arg'] . '.atom';
+
+ header('Content-Type: application/atom+xml; charset=utf-8');
+
+ // If this was called using an integer ID, i.e.: using the canonical
+ // URL for this user's feed, then pass the User object into the feed,
+ // so the OStatus plugin, and possibly other plugins, can access it.
+ // Feels sorta hacky. -- Z
+
+ $atom = null;
+ $id = $this->arg('id');
+
+ if (strval(intval($id)) === strval($id)) {
+ $atom = new AtomUserNoticeFeed($this->user);
} else {
- $selfuri = common_root_url() .
- 'api/statuses/user_timeline.atom';
+ $atom = new AtomUserNoticeFeed();
+ }
+
+ $atom->setId($id);
+ $atom->setTitle($title);
+ $atom->setSubtitle($subtitle);
+ $atom->setLogo($logo);
+ $atom->setUpdated('now');
+
+ $atom->addLink(
+ common_local_url(
+ 'showstream',
+ array('nickname' => $this->user->nickname)
+ )
+ );
+
+ $id = $this->arg('id');
+ $aargs = array('format' => 'atom');
+ if (!empty($id)) {
+ $aargs['id'] = $id;
}
- $this->showAtomTimeline(
- $this->notices, $title, $id, $link,
- $subtitle, $suplink, $selfuri, $logo
+
+ $atom->addLink(
+ $this->getSelfUri('ApiTimelineUser', $aargs),
+ array('rel' => 'self', 'type' => 'application/atom+xml')
+ );
+
+ $atom->addLink(
+ $suplink,
+ array(
+ 'rel' => 'http://api.friendfeed.com/2008/03#sup',
+ 'type' => 'application/json'
+ )
);
+
+ $atom->addEntryFromNotices($this->notices);
+
+ #$this->raw($atom->getString());
+ print $atom->getString(); // temporary for output buffering
+
break;
case 'json':
$this->showJsonTimeline($this->notices);