summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/apitimelineuser.php2
-rw-r--r--classes/Notice.php38
-rw-r--r--classes/Profile.php49
-rw-r--r--lib/atom10feed.php2
-rw-r--r--lib/atomnoticefeed.php18
5 files changed, 98 insertions, 11 deletions
diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php
index bcc48f59c..cb8213619 100644
--- a/actions/apitimelineuser.php
+++ b/actions/apitimelineuser.php
@@ -189,7 +189,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
$atom->addEntryFromNotices($this->notices);
- print $atom->getString();
+ $this->raw($atom->getString());
break;
case 'json':
diff --git a/classes/Notice.php b/classes/Notice.php
index 247440f29..091f2dc7b 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -957,7 +957,10 @@ class Notice extends Memcached_DataObject
if ($namespace) {
$attrs = array('xmlns' => 'http://www.w3.org/2005/Atom',
- 'xmlns:thr' => 'http://purl.org/syndication/thread/1.0');
+ 'xmlns:thr' => 'http://purl.org/syndication/thread/1.0',
+ 'xmlns:georss' => 'http://www.georss.org/georss',
+ 'xmlns:activity' => 'http://activitystrea.ms/spec/1.0/',
+ 'xmlns:ostatus' => 'http://ostatus.org/schema/1.0');
} else {
$attrs = array();
}
@@ -983,11 +986,6 @@ class Notice extends Memcached_DataObject
$xs->element('icon', null, $profile->avatarUrl(AVATAR_PROFILE_SIZE));
}
- $xs->elementStart('author');
- $xs->element('name', null, $profile->nickname);
- $xs->element('uri', null, $profile->profileurl);
- $xs->elementEnd('author');
-
if ($source) {
$xs->elementEnd('source');
}
@@ -995,6 +993,9 @@ class Notice extends Memcached_DataObject
$xs->element('title', null, $this->content);
$xs->element('summary', null, $this->content);
+ $xs->raw($profile->asAtomAuthor());
+ $xs->raw($profile->asActivityActor($namespace));
+
$xs->element('link', array('rel' => 'alternate',
'href' => $this->bestUrl()));
@@ -1014,6 +1015,29 @@ class Notice extends Memcached_DataObject
}
}
+ if (!empty($this->conversation)
+ && $this->conversation != $this->notice->id) {
+ $xs->element(
+ 'link', array(
+ 'rel' => 'osatus:conversation',
+ 'href' => common_local_url(
+ 'conversation',
+ array('id' => $this->conversation)
+ )
+ )
+ );
+ }
+
+ if (!empty($this->repeat_of)) {
+ $repeat = Notice::staticGet('id', $this->repeat_of);
+ if (!empty($repeat)) {
+ $xs->element(
+ 'ostatus:forward',
+ array('ref' => $repeat->uri, 'href' => $repeat->bestUrl())
+ );
+ }
+ }
+
$xs->element('content', array('type' => 'html'), $this->rendered);
$tag = new Notice_tag();
@@ -1041,9 +1065,7 @@ class Notice extends Memcached_DataObject
}
if (!empty($this->lat) && !empty($this->lon)) {
- $xs->elementStart('geo', array('xmlns:georss' => 'http://www.georss.org/georss'));
$xs->element('georss:point', null, $this->lat . ' ' . $this->lon);
- $xs->elementEnd('geo');
}
$xs->elementEnd('entry');
diff --git a/classes/Profile.php b/classes/Profile.php
index feabc2508..664c45f64 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -754,4 +754,53 @@ class Profile extends Memcached_DataObject
return !empty($notice);
}
+
+ function asAtomAuthor()
+ {
+ $xs = new XMLStringer(true);
+
+ $xs->elementStart('author');
+ $xs->element('name', null, $this->nickname);
+ $xs->element('uri', null, $this->profileurl);
+ $xs->elementEnd('author');
+
+ return $xs->getString();
+ }
+
+ function asActivityActor()
+ {
+ $xs = new XMLStringer(true);
+
+ $xs->elementStart('activity:actor');
+ $xs->element(
+ 'activity:object-type',
+ null,
+ 'http://activitystrea.ms/schema/1.0/person'
+ );
+ $xs->element(
+ 'id',
+ null,
+ common_local_url(
+ 'userbyid',
+ array('id' => $this->id)
+ )
+ );
+ $xs->element('title', null, $this->getBestName());
+
+ $avatar = $this->getAvatar(AVATAR_PROFILE_SIZE);
+
+ $xs->element(
+ 'link', array(
+ 'type' => empty($avatar) ? 'image/png' : $avatar->mediatype,
+ 'href' => empty($avatar)
+ ? Avatar::defaultImage(AVATAR_PROFILE_SIZE)
+ : $avatar->displayUrl()
+ ),
+ ''
+ );
+
+ $xs->elementEnd('activity:actor');
+
+ return $xs->getString();
+ }
}
diff --git a/lib/atom10feed.php b/lib/atom10feed.php
index 9dd8ebc9b..01fc69072 100644
--- a/lib/atom10feed.php
+++ b/lib/atom10feed.php
@@ -153,7 +153,7 @@ class Atom10Feed extends XMLStringer
* Assumes you want rel="alternate" and type="text/html" unless
* you send in $otherAttrs.
*
- * @param string $uri the uri the href need to point to
+ * @param string $uri the uri the href needs to point to
* @param array $otherAttrs other attributes to stick in
*
* @return void
diff --git a/lib/atomnoticefeed.php b/lib/atomnoticefeed.php
index a28c9cda7..ce87ec9e6 100644
--- a/lib/atomnoticefeed.php
+++ b/lib/atomnoticefeed.php
@@ -5,12 +5,28 @@ class AtomNoticeFeed extends Atom10Feed
function __construct($indent = true) {
parent::__construct($indent);
- // Feeds containing notice info use the Atom Threading Extensions
+ // Feeds containing notice info use these namespaces
$this->addNamespace(
'xmlns:thr',
'http://purl.org/syndication/thread/1.0'
);
+
+ $this->addNamespace(
+ 'xmlns:georss',
+ 'http://www.georss.org/georss'
+ );
+
+ $this->addNamespace(
+ 'xmlns:activity',
+ 'http://activitystrea.ms/spec/1.0/'
+ );
+
+ // XXX: What should the uri be?
+ $this->addNamespace(
+ 'xmlns:ostatus',
+ 'http://ostatus.org/schema/1.0'
+ );
}
function addEntryFromNotices($notices)