summaryrefslogtreecommitdiff
path: root/plugins/OStatus/actions
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-02-19 16:21:17 -0800
committerBrion Vibber <brion@pobox.com>2010-02-19 16:21:17 -0800
commit557df3d3f78dbfce656c4c8e3ddf82ee0e34da0a (patch)
treeebc29f47b4319e3cab55b7677baf71f2c3c19231 /plugins/OStatus/actions
parentd69f6dff6a0b62ddab929f6ba0801533a9031162 (diff)
OStatus: sub/unsub notifications working again. Fixed up autodetection of feed info at profile setup time
Diffstat (limited to 'plugins/OStatus/actions')
-rw-r--r--plugins/OStatus/actions/salmon.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/OStatus/actions/salmon.php b/plugins/OStatus/actions/salmon.php
index 7a4474ff6..43d79cf4a 100644
--- a/plugins/OStatus/actions/salmon.php
+++ b/plugins/OStatus/actions/salmon.php
@@ -34,6 +34,8 @@ class SalmonAction extends Action
function prepare($args)
{
+ StatusNet::setApi(true); // Send smaller error pages
+
parent::prepare($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
@@ -63,8 +65,12 @@ class SalmonAction extends Action
// XXX: check that document element is Atom entry
// XXX: check the signature
- $this->act = new Activity($dom->documentElement);
-
+ // 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);
+ }
return true;
}
@@ -74,7 +80,9 @@ class SalmonAction extends Action
function handle($args)
{
+ StatusNet::setApi(true); // Send smaller error pages
common_log(LOG_INFO, 'Salmon: incoming post for user '. $this->user->id);
+ common_log(LOG_DEBUG, "Received salmon bit: " . var_export($this->act, true));
// TODO : Insert new $xml -> notice code
@@ -254,7 +262,6 @@ class SalmonAction extends Action
function ensureProfile()
{
$actor = $this->act->actor;
- common_log(LOG_DEBUG, "Received salmon bit: " . var_export($this->act, true));
if (empty($actor->id)) {
common_log(LOG_ERR, "broken actor: " . var_export($actor, true));
throw new Exception("Received a salmon slap from unidentified actor.");