summaryrefslogtreecommitdiff
path: root/lib/atomnoticefeed.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/atomnoticefeed.php')
-rw-r--r--lib/atomnoticefeed.php38
1 files changed, 34 insertions, 4 deletions
diff --git a/lib/atomnoticefeed.php b/lib/atomnoticefeed.php
index 3c3556cb9..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/'
+ );
}
/**
@@ -107,9 +125,21 @@ class AtomNoticeFeed extends Atom10Feed
*/
function addEntryFromNotice($notice)
{
- $this->addEntryRaw($notice->asAtomEntry());
- }
+ $source = $this->showSource();
+ $author = $this->showAuthor();
-}
+ $cur = empty($this->cur) ? common_current_user() : $this->cur;
+ $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $cur));
+ }
+ function showSource()
+ {
+ return true;
+ }
+
+ function showAuthor()
+ {
+ return true;
+ }
+}