]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/atomnoticefeed.php
Use original config class as readArray was added upstream
[quix0rs-gnu-social.git] / lib / atomnoticefeed.php
index e4df731fe02a5c3bdb7657f6d504177395345ae1..6ed803ce4ebb35a0350f669b26fc098b896a3585 100644 (file)
@@ -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()