summaryrefslogtreecommitdiff
path: root/plugins/OStatus
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-02-19 17:01:38 -0800
committerBrion Vibber <brion@pobox.com>2010-02-19 17:01:38 -0800
commit50db2d5d69a8769dc2ddcc937afb130bcce0971d (patch)
treea680dd1c57b7ca56c281eb682eb5d1f3065888b6 /plugins/OStatus
parent557df3d3f78dbfce656c4c8e3ddf82ee0e34da0a (diff)
OStatus: Salmon notifications now being generated moderately correctly. :) Needs to be an <entry> not a <feed>.
Diffstat (limited to 'plugins/OStatus')
-rw-r--r--plugins/OStatus/actions/salmon.php12
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php15
2 files changed, 14 insertions, 13 deletions
diff --git a/plugins/OStatus/actions/salmon.php b/plugins/OStatus/actions/salmon.php
index 43d79cf4a..f7c86dc0c 100644
--- a/plugins/OStatus/actions/salmon.php
+++ b/plugins/OStatus/actions/salmon.php
@@ -62,15 +62,13 @@ class SalmonAction extends Action
$dom = DOMDocument::loadXML($xml);
- // XXX: check that document element is Atom entry
+ if ($dom->documentElement->namespaceURI != Activity::ATOM ||
+ $dom->documentElement->localName != 'entry') {
+ $this->clientError(_m('Salmon post must be an Atom entry.'));
+ }
// XXX: check the signature
- // We need to run an entry into Activity, so get the first one
- $entries = $dom->getElementsByTagNameNS(Activity::ATOM, 'entry');
- if ($entries && $entries->length) {
- // @fixme is it legit to have multiple entries?
- $this->act = new Activity($entries->item(0), $dom->documentElement);
- }
+ $this->act = new Activity($dom->documentElement);
return true;
}
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index 5fe135f96..b14b4c9a3 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -329,9 +329,15 @@ class Ostatus_profile extends Memcached_DataObject
':' . $actor->id .
':' . time(); // @fixme
- //$entry = new Atom10Entry();
+ // @fixme consolidate all these NS settings somewhere
+ $attributes = array('xmlns' => Activity::ATOM,
+ 'xmlns:activity' => 'http://activitystrea.ms/spec/1.0/',
+ 'xmlns:thr' => 'http://purl.org/syndication/thread/1.0',
+ 'xmlns:georss' => 'http://www.georss.org/georss',
+ 'xmlns:ostatus' => 'http://ostatus.org/schema/1.0');
+
$entry = new XMLStringer();
- $entry->elementStart('entry');
+ $entry->elementStart('entry', $attributes);
$entry->element('id', null, $id);
$entry->element('title', null, $text);
$entry->element('summary', null, $text);
@@ -343,10 +349,7 @@ class Ostatus_profile extends Memcached_DataObject
$entry->raw($object->asActivityNoun('object'));
$entry->elementEnd('entry');
- $feed = $this->atomFeed($actor);
- $feed->addEntry($entry);
-
- $xml = $feed->getString();
+ $xml = $entry->getString();
common_log(LOG_INFO, "Posting to Salmon endpoint $this->salmonuri: $xml");
$salmon = new Salmon(); // ?