*/
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(
'ostatus',
'http://ostatus.org/schema/1.0'
);
+
+ $this->addNamespace(
+ 'statusnet',
+ 'http://status.net/schema/api/1/'
+ );
}
/**
*/
function addEntryFromNotice($notice)
{
- $this->addEntryRaw($notice->asAtomEntry());
- }
+ try {
+ $source = $this->showSource();
+ $author = $this->showAuthor();
-}
+ $cur = empty($this->cur) ? common_current_user() : $this->cur;
+ $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $cur));
+ } catch (Exception $e) {
+ common_log(LOG_ERR, $e->getMessage());
+ // we continue on exceptions
+ }
+ }
+ function showSource()
+ {
+ return true;
+ }
+
+ function showAuthor()
+ {
+ return true;
+ }
+}