summaryrefslogtreecommitdiff
path: root/lib/atomusernoticefeed.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-03 12:51:23 -0800
committerBrion Vibber <brion@pobox.com>2010-03-03 16:33:20 -0800
commit9fadf8da1164d620284917b829329e195aa2a226 (patch)
treeff642f7abca80ee2e9b1d6ba1c97c20b250a88bd /lib/atomusernoticefeed.php
parent04e474c98c9b907fe2d0f263fad79018a15c0783 (diff)
Put all required field setup into AtomUserNoticeFeed and AtomGroupNoticeFeed, consolidating some code. (RSS feeds pulling title, logo etc from the Atom data structure so we don't dupe it.)
OStatus now calling the feed classes directly instead of faking a call into the API, should be less flakey.
Diffstat (limited to 'lib/atomusernoticefeed.php')
-rw-r--r--lib/atomusernoticefeed.php41
1 files changed, 39 insertions, 2 deletions
diff --git a/lib/atomusernoticefeed.php b/lib/atomusernoticefeed.php
index 2ad8de455..55cebef6d 100644
--- a/lib/atomusernoticefeed.php
+++ b/lib/atomusernoticefeed.php
@@ -49,19 +49,56 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
/**
* Constructor
*
- * @param User $user the user for the feed (optional)
+ * @param User $user the user for the feed
* @param boolean $indent flag to turn indenting on or off
*
* @return void
*/
- function __construct($user = null, $indent = true) {
+ function __construct($user, $indent = true) {
parent::__construct($indent);
$this->user = $user;
if (!empty($user)) {
$profile = $user->getProfile();
$this->addAuthor($profile->nickname, $user->uri);
}
+
+ $title = sprintf(_("%s timeline"), $user->nickname);
+ $this->setTitle($title);
+
+ $sitename = common_config('site', 'name');
+ $subtitle = sprintf(
+ _('Updates from %1$s on %2$s!'),
+ $user->nickname, $sitename
+ );
+ $this->setSubtitle($subtitle);
+
+ $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
+ $logo = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
+ $this->setLogo($logo);
+
+ $this->setUpdated('now');
+
+ $this->addLink(
+ common_local_url(
+ 'showstream',
+ array('nickname' => $user->nickname)
+ )
+ );
+
+ $self = common_local_url('ApiTimelineUser',
+ array('id' => $user->id,
+ 'format' => 'atom'));
+ $this->setId($self);
+ $this->setSelfLink($self);
+
+ $this->addLink(
+ common_local_url('sup', null, null, $user->id),
+ array(
+ 'rel' => 'http://api.friendfeed.com/2008/03#sup',
+ 'type' => 'application/json'
+ )
+ );
}
function getUser()