We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit b54ea676 authored by Evan Prodromou's avatar Evan Prodromou

New event for Salmon including target

parent 4777c927
...@@ -47,6 +47,9 @@ class GroupsalmonAction extends SalmonAction ...@@ -47,6 +47,9 @@ class GroupsalmonAction extends SalmonAction
$this->clientError(_m('No such group.')); $this->clientError(_m('No such group.'));
} }
$this->target = $this->group;
$oprofile = Ostatus_profile::staticGet('group_id', $id); $oprofile = Ostatus_profile::staticGet('group_id', $id);
if ($oprofile) { if ($oprofile) {
// TRANS: Client error. // TRANS: Client error.
......
...@@ -43,6 +43,8 @@ class UsersalmonAction extends SalmonAction ...@@ -43,6 +43,8 @@ class UsersalmonAction extends SalmonAction
$this->clientError(_m('No such user.')); $this->clientError(_m('No such user.'));
} }
$this->target = $this->user;
return true; return true;
} }
......
...@@ -30,6 +30,7 @@ class SalmonAction extends Action ...@@ -30,6 +30,7 @@ class SalmonAction extends Action
{ {
var $xml = null; var $xml = null;
var $activity = null; var $activity = null;
var $target = null;
function prepare($args) function prepare($args)
{ {
...@@ -82,7 +83,8 @@ class SalmonAction extends Action ...@@ -82,7 +83,8 @@ class SalmonAction extends Action
StatusNet::setApi(true); // Send smaller error pages StatusNet::setApi(true); // Send smaller error pages
common_log(LOG_DEBUG, "Got a " . $this->activity->verb); 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) switch ($this->activity->verb)
{ {
case ActivityVerb::POST: case ActivityVerb::POST:
...@@ -118,6 +120,7 @@ class SalmonAction extends Action ...@@ -118,6 +120,7 @@ class SalmonAction extends Action
throw new ClientException(_m("Unrecognized activity type.")); throw new ClientException(_m("Unrecognized activity type."));
} }
Event::handle('EndHandleSalmon', array($this->activity)); Event::handle('EndHandleSalmon', array($this->activity));
Event::handle('EndHandleSalmonTarget', array($this->activity, $this->target));
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment