New event for Salmon including target

This commit is contained in:
Evan Prodromou 2010-12-27 10:51:59 -08:00
parent 4777c927ad
commit b54ea6767a
3 changed files with 9 additions and 1 deletions

View File

@ -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.

View File

@ -43,6 +43,8 @@ class UsersalmonAction extends SalmonAction
$this->clientError(_m('No such user.'));
}
$this->target = $this->user;
return true;
}

View File

@ -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));
}
}