case 'json':
$this->showJsonTimeline($this->notices);
break;
+ case 'as':
+ header('Content-Type: application/json; charset=utf-8');
+ $doc = new ActivityStreamJSONDocument($this->auth_user);
+ $doc->setTitle($title);
+ $doc->addLink($link,'alternate', 'text/html');
+ $doc->addItemsFromNotices($this->notices);
+ $this->raw($doc->asString());
+ break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
$self = $this->getSelfUri();
+ $link = common_local_url(
+ 'ApiTimelineGroup',
+ array('nickname' => $this->group->nickname)
+ );
+
switch($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
-
- try {
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
- } catch (Atom10FeedException $e) {
- $this->serverError(
- // TRANS: Server error displayed when generating an Atom feed fails.
- // TRANS: %s is the error.
- sprintf(_('Could not generate feed for group - %s'),$e->getMessage()),
- 400,
- $this->format
- );
- return;
- }
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
+ case 'as':
+ header('Content-Type: application/json; charset=utf-8');
+ $doc = new ActivityStreamJSONDocument($this->auth_user);
+ $doc->setTitle($atom->title);
+ $doc->addLink($link, 'alternate', 'text/html');
+ $doc->addItemsFromNotices($this->notices);
+ $this->raw($doc->asString());
+ break;
default:
$this->clientError(
// TRANS: Client error displayed when trying to handle an unknown API method.
case 'json':
$this->showJsonTimeline($this->notices);
break;
+ case 'as':
+ header('Content-Type: application/json; charset=utf-8');
+ $doc = new ActivityStreamJSONDocument($this->auth_user);
+ $doc->setTitle($title);
+ $doc->addLink($link, 'alternate', 'text/html');
+ $doc->addItemsFromNotices($this->notices);
+ $this->raw($doc->asString());
+ break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
case 'json':
$this->showJsonTimeline($this->notices);
break;
+ case 'as':
+ header('Content-Type: application/json; charset=utf-8');
+ $doc = new ActivityStreamJSONDocument($this->auth_user);
+ $doc->setTitle($title);
+ $doc->addLink($link, 'alternate', 'text/html');
+ $doc->addItemsFromNotices($this->notices);
+ $this->raw($doc->asString());
+ break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
case 'json':
$this->showJsonTimeline($this->notices);
break;
+ case 'as':
+ header('Content-Type: application/json; charset=utf-8');
+ $doc = new ActivityStreamJSONDocument($this->auth_user);
+ $doc->setTitle($title);
+ $doc->addLink($link, 'alternate', 'text/html');
+ $doc->addItemsFromNotices($this->notices);
+ $this->raw($doc->asString());
+ break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
$offset = ($this->page-1) * $this->cnt;
$limit = $this->cnt;
+ // TRANS: Title for Atom feed "repeated to me". %s is the user nickname.
+ $title = sprintf(_("Repeated to %s"), $this->auth_user->nickname);
+ $subtitle = sprintf(
+ _('%1$s notices that were to repeated to %2$s / %3$s.'),
+ $sitename, $this->user->nickname, $profile->getBestName()
+ );
+ $taguribase = TagURI::base();
+ $id = "tag:$taguribase:RepeatedToMe:" . $this->auth_user->id;
+
+ $link = common_local_url(
+ 'all',
+ array('nickname' => $this->auth_user->nickname)
+ );
+
$strm = $this->auth_user->repeatedToMe($offset, $limit, $this->since_id, $this->max_id);
switch ($this->format) {
$this->showJsonTimeline($strm);
break;
case 'atom':
- $profile = $this->auth_user->getProfile();
+ header('Content-Type: application/atom+xml; charset=utf-8');
+
+ $atom = new AtomNoticeFeed($this->auth_user);
+
+ $atom->setId($id);
+ $atom->setTitle($title);
+ $atom->setSubtitle($subtitle);
+ $atom->setUpdated('now');
+ $atom->addLink($link);
- // TRANS: Title for Atom feed "repeated to me". %s is the user nickname.
- $title = sprintf(_("Repeated to %s"), $this->auth_user->nickname);
- $taguribase = TagURI::base();
- $id = "tag:$taguribase:RepeatedToMe:" . $this->auth_user->id;
- $link = common_local_url('all',
- array('nickname' => $this->auth_user->nickname));
+ $id = $this->arg('id');
- $this->showAtomTimeline($strm, $title, $id, $link);
+ $atom->setSelfLink($self);
+ $atom->addEntryFromNotices($strm);
+
+ $this->raw($atom->getString());
+
+ break;
+ case 'as':
+ header('Content-Type: application/json; charset=utf-8');
+ $doc = new ActivityStreamJSONDocument($this->auth_user);
+ $doc->setTitle($title);
+ $doc->addLink($link, 'alternate', 'text/html');
+ $doc->addItemsFromNotices($strm);
+ $this->raw($doc->asString());
break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$offset = ($this->page-1) * $this->cnt;
$limit = $this->cnt;
- $strm = $this->auth_user->repeatsOfMe($offset, $limit, $this->since_id, $this->max_id);
+ // TRANS: Title of list of repeated notices of the logged in user.
+ // TRANS: %s is the nickname of the logged in user.
+ $title = sprintf(_("Repeats of %s"), $this->auth_user->nickname);
+ $sitename = common_config('site', 'name');
+
+ $profile = $this->auth_user->getProfile();
+
+ $subtitle = sprintf(
+ _('%1$s notices that %2$s / %3$s has repeated.'),
+ $sitename, $this->auth_user->nickname, $profile->getBestName()
+ );
- common_debug(var_export($strm, true));
+ $taguribase = TagURI::base();
+ $id = "tag:$taguribase:RepeatsOfMe:" . $this->auth_user->id;
+
+ $link = common_local_url(
+ 'all',
+ array('nickname' => $this->auth_user->nickname)
+ );
+
+ $strm = $this->auth_user->repeatsOfMe($offset, $limit, $this->since_id, $this->max_id);
switch ($this->format) {
case 'xml':
$this->showJsonTimeline($strm);
break;
case 'atom':
- $profile = $this->auth_user->getProfile();
-
- // TRANS: Title of list of repeated notices of the logged in user.
- // TRANS: %s is the nickname of the logged in user.
- $title = sprintf(_("Repeats of %s"), $this->auth_user->nickname);
- $taguribase = TagURI::base();
- $id = "tag:$taguribase:RepeatsOfMe:" . $this->auth_user->id;
-
header('Content-Type: application/atom+xml; charset=utf-8');
-
$atom = new AtomNoticeFeed($this->auth_user);
-
$atom->setId($id);
$atom->setTitle($title);
$atom->setSubtitle($subtitle);
$atom->setUpdated('now');
-
- $atom->addLink(
- common_local_url(
- 'showstream',
- array('nickname' => $this->auth_user->nickname)
- )
- );
-
- $id = $this->arg('id');
- $aargs = array('format' => 'atom');
- if (!empty($id)) {
- $aargs['id'] = $id;
- }
-
- $atom->addLink(
- $this->getSelfUri('ApiTimelineRetweetsOfMe', $aargs),
- array('rel' => 'self', 'type' => 'application/atom+xml')
- );
-
+ $atom->addLink($link);
+ $atom->setSelfLink($this->getSelfUri());
$atom->addEntryFromNotices($strm);
-
$this->raw($atom->getString());
-
+ break;
+ case 'as':
+ header('Content-Type: application/json; charset=utf-8');
+ $doc = new ActivityStreamJSONDocument($this->auth_user);
+ $doc->setTitle($title);
+ $doc->addLink($link, 'alternate', 'text/html');
+ $doc->addItemsFromNotices($strm);
+ $this->raw($doc->asString());
break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
- $this->clientError(_('API method not found.'), $code = 404);
+ $this->clientError(_('API method not found.'), 404);
break;
}
}
$sitename
);
$taguribase = TagURI::base();
- $id = "tag:$taguribase:TagTimeline:".$tag;
+ $id = "tag:$taguribase:TagTimeline:".$this->tag;
$link = common_local_url(
'tag',
$self = $this->getSelfUri();
- common_debug("self link is: $self");
-
switch($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
case 'json':
$this->showJsonTimeline($this->notices);
break;
+ case 'as':
+ header('Content-Type: application/json; charset=utf-8');
+ $doc = new ActivityStreamJSONDocument($this->auth_user);
+ $doc->setTitle($title);
+ $doc->addLink($link, 'alternate', 'text/html');
+ $doc->addItemsFromNotices($this->notices);
+ $this->raw($doc->asString());
+ break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
case 'json':
$this->showJsonTimeline($this->notices);
break;
+ case 'as':
+ header('Content-Type: application/json; charset=utf-8');
+ $doc = new ActivityStreamJSONDocument($this->auth_user);
+ $doc->setTitle($atom->title);
+ $doc->addLink($link, 'alternate', 'text/html');
+ $doc->addItemsFromNotices($this->notices);
+
+ // XXX: Add paging extension?
+
+ $this->raw($doc->asString());
+ break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
$m->connect('api/statuses/public_timeline.:format',
array('action' => 'ApiTimelinePublic',
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/friends_timeline.:format',
array('action' => 'ApiTimelineFriends',
$m->connect('api/statuses/friends_timeline/:id.:format',
array('action' => 'ApiTimelineFriends',
'id' => Nickname::INPUT_FMT,
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/home_timeline.:format',
array('action' => 'ApiTimelineHome',
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/home_timeline/:id.:format',
array('action' => 'ApiTimelineHome',
'id' => Nickname::INPUT_FMT,
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/user_timeline.:format',
array('action' => 'ApiTimelineUser',
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/user_timeline/:id.:format',
array('action' => 'ApiTimelineUser',
'id' => Nickname::INPUT_FMT,
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/mentions.:format',
array('action' => 'ApiTimelineMentions',
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/mentions/:id.:format',
array('action' => 'ApiTimelineMentions',
'id' => Nickname::INPUT_FMT,
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/replies.:format',
array('action' => 'ApiTimelineMentions',
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/replies/:id.:format',
array('action' => 'ApiTimelineMentions',
'id' => Nickname::INPUT_FMT,
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statuses/retweeted_by_me.:format',
array('action' => 'ApiTimelineRetweetedByMe',
- 'format' => '(xml|json|atom)'));
+ 'format' => '(xml|json|atom|as)'));
$m->connect('api/statuses/retweeted_to_me.:format',
array('action' => 'ApiTimelineRetweetedToMe',
- 'format' => '(xml|json|atom)'));
+ 'format' => '(xml|json|atom|as)'));
$m->connect('api/statuses/retweets_of_me.:format',
array('action' => 'ApiTimelineRetweetsOfMe',
- 'format' => '(xml|json|atom)'));
+ 'format' => '(xml|json|atom|as)'));
$m->connect('api/statuses/friends.:format',
array('action' => 'ApiUserFriends',
$m->connect('api/favorites.:format',
array('action' => 'ApiTimelineFavorites',
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/favorites/:id.:format',
array('action' => 'ApiTimelineFavorites',
'id' => Nickname::INPUT_FMT,
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/favorites/create/:id.:format',
array('action' => 'ApiFavoriteCreate',
$m->connect('api/statusnet/groups/timeline/:id.:format',
array('action' => 'ApiTimelineGroup',
'id' => Nickname::INPUT_FMT,
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
$m->connect('api/statusnet/groups/show.:format',
array('action' => 'ApiGroupShow',
// Tags
$m->connect('api/statusnet/tags/timeline/:tag.:format',
array('action' => 'ApiTimelineTag',
- 'format' => '(xml|json|rss|atom)'));
+ 'format' => '(xml|json|rss|atom|as)'));
// media related
$m->connect(