diff options
author | Zach Copley <zach@status.net> | 2010-05-05 22:35:16 -0700 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-05-06 21:48:11 +0000 |
commit | b547079b280b9fa2f8877aab7ad5cd3761f500b9 (patch) | |
tree | 1c2818f54c6cb517493f37757d8f19f17058f2a7 | |
parent | e05415f621890bbaf42752577249ecdc22c161fc (diff) |
Add xmlns:statusnet and statusnet:notice_info element to Atom entries for notices
-rw-r--r-- | classes/Notice.php | 17 | ||||
-rw-r--r-- | lib/atomnoticefeed.php | 9 |
2 files changed, 23 insertions, 3 deletions
diff --git a/classes/Notice.php b/classes/Notice.php index c0828674d..e82a82526 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -1172,7 +1172,7 @@ class Notice extends Memcached_DataObject return $groups; } - function asAtomEntry($namespace=false, $source=false, $author=true) + function asAtomEntry($namespace=false, $source=false, $author=true, $cur=null) { $profile = $this->getProfile(); @@ -1185,7 +1185,8 @@ class Notice extends Memcached_DataObject 'xmlns:activity' => 'http://activitystrea.ms/spec/1.0/', 'xmlns:media' => 'http://purl.org/syndication/atommedia', 'xmlns:poco' => 'http://portablecontacts.net/spec/1.0', - 'xmlns:ostatus' => 'http://ostatus.org/schema/1.0'); + 'xmlns:ostatus' => 'http://ostatus.org/schema/1.0', + 'xmlns:statusnet' => 'http://status.net/ont/'); } else { $attrs = array(); } @@ -1211,6 +1212,18 @@ class Notice extends Memcached_DataObject $xs->element('icon', null, $profile->avatarUrl(AVATAR_PROFILE_SIZE)); $xs->element('updated', null, common_date_w3dtf($this->created)); + + $noticeInfoAttr = array( + 'local_id' => $this->id, // local notice ID (useful to clients for ordering) + 'source' => $this->source // the client name (source attribution) + // @todo source source_link + ); + + if (!empty($cur)) { + $noticeInfoAttr['favorited'] = ($cur->hasFave($this)) ? 'true' : 'false'; + } + + $xs->element('statusnet:notice_info', $noticeInfoAttr, null); } if ($source) { diff --git a/lib/atomnoticefeed.php b/lib/atomnoticefeed.php index e4df731fe..35a45118c 100644 --- a/lib/atomnoticefeed.php +++ b/lib/atomnoticefeed.php @@ -79,6 +79,11 @@ class AtomNoticeFeed extends Atom10Feed 'ostatus', 'http://ostatus.org/schema/1.0' ); + + $this->addNamespace( + 'statusnet', + 'http://status.net/ont/' + ); } /** @@ -110,7 +115,9 @@ class AtomNoticeFeed extends Atom10Feed $source = $this->showSource(); $author = $this->showAuthor(); - $this->addEntryRaw($notice->asAtomEntry(false, $source, $author)); + $cur = common_current_user(); + + $this->addEntryRaw($notice->asAtomEntry(false, $source, $author, $cur)); } function showSource() |