diff options
Diffstat (limited to 'lib/atomnoticefeed.php')
-rw-r--r-- | lib/atomnoticefeed.php | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/atomnoticefeed.php b/lib/atomnoticefeed.php index e4df731fe..6ed803ce4 100644 --- a/lib/atomnoticefeed.php +++ b/lib/atomnoticefeed.php @@ -44,9 +44,22 @@ if (!defined('STATUSNET')) */ class AtomNoticeFeed extends Atom10Feed { - function __construct($indent = true) { + var $cur; + + /** + * Constructor - adds a bunch of XML namespaces we need in our + * notice-specific Atom feeds, and allows setting the current + * authenticated user (useful for API methods). + * + * @param User $cur the current authenticated user (optional) + * @param boolean $indent Whether to indent XML output + * + */ + function __construct($cur = null, $indent = true) { parent::__construct($indent); + $this->cur = $cur; + // Feeds containing notice info use these namespaces $this->addNamespace( @@ -79,6 +92,11 @@ class AtomNoticeFeed extends Atom10Feed 'ostatus', 'http://ostatus.org/schema/1.0' ); + + $this->addNamespace( + 'statusnet', + 'http://status.net/schema/api/1/' + ); } /** @@ -110,7 +128,9 @@ class AtomNoticeFeed extends Atom10Feed $source = $this->showSource(); $author = $this->showAuthor(); - $this->addEntryRaw($notice->asAtomEntry(false, $source, $author)); + $cur = empty($this->cur) ? common_current_user() : $this->cur; + + $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $cur)); } function showSource() |