From: Evan Prodromou Date: Mon, 27 Dec 2010 18:51:59 +0000 (-0800) Subject: New event for Salmon including target X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b54ea6767a510f0d7c9af140bb16a0b9ecc4f0ce;p=quix0rs-gnu-social.git New event for Salmon including target --- diff --git a/plugins/OStatus/actions/groupsalmon.php b/plugins/OStatus/actions/groupsalmon.php index 3a3d63fe20..024f0cc217 100644 --- a/plugins/OStatus/actions/groupsalmon.php +++ b/plugins/OStatus/actions/groupsalmon.php @@ -47,6 +47,9 @@ class GroupsalmonAction extends SalmonAction $this->clientError(_m('No such group.')); } + + $this->target = $this->group; + $oprofile = Ostatus_profile::staticGet('group_id', $id); if ($oprofile) { // TRANS: Client error. diff --git a/plugins/OStatus/actions/usersalmon.php b/plugins/OStatus/actions/usersalmon.php index e78c653300..5355aeba03 100644 --- a/plugins/OStatus/actions/usersalmon.php +++ b/plugins/OStatus/actions/usersalmon.php @@ -43,6 +43,8 @@ class UsersalmonAction extends SalmonAction $this->clientError(_m('No such user.')); } + $this->target = $this->user; + return true; } diff --git a/plugins/OStatus/lib/salmonaction.php b/plugins/OStatus/lib/salmonaction.php index 41bdb48928..8bfd7c8261 100644 --- a/plugins/OStatus/lib/salmonaction.php +++ b/plugins/OStatus/lib/salmonaction.php @@ -30,6 +30,7 @@ class SalmonAction extends Action { var $xml = null; var $activity = null; + var $target = null; function prepare($args) { @@ -82,7 +83,8 @@ class SalmonAction extends Action StatusNet::setApi(true); // Send smaller error pages common_log(LOG_DEBUG, "Got a " . $this->activity->verb); - if (Event::handle('StartHandleSalmon', array($this->activity))) { + if (Event::handle('StartHandleSalmonTarget', array($this->activity, $this->target)) && + Event::handle('StartHandleSalmon', array($this->activity))) { switch ($this->activity->verb) { case ActivityVerb::POST: @@ -118,6 +120,7 @@ class SalmonAction extends Action throw new ClientException(_m("Unrecognized activity type.")); } Event::handle('EndHandleSalmon', array($this->activity)); + Event::handle('EndHandleSalmonTarget', array($this->activity, $this->target)); } }