]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
New event for Salmon including target
authorEvan Prodromou <evan@status.net>
Mon, 27 Dec 2010 18:51:59 +0000 (10:51 -0800)
committerEvan Prodromou <evan@status.net>
Mon, 27 Dec 2010 18:51:59 +0000 (10:51 -0800)
plugins/OStatus/actions/groupsalmon.php
plugins/OStatus/actions/usersalmon.php
plugins/OStatus/lib/salmonaction.php

index 3a3d63fe20568a11e29ecf899117db137f628c11..024f0cc217a6000cb56cda8526bb601e7bcf90b1 100644 (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.
index e78c653300da11dd504afa0e21aa1a63badda4c2..5355aeba03fed5b2eca9c762709d3466aae00f4b 100644 (file)
@@ -43,6 +43,8 @@ class UsersalmonAction extends SalmonAction
             $this->clientError(_m('No such user.'));
         }
 
+        $this->target = $this->user;
+
         return true;
     }
 
index 41bdb489284a75072682c3351f7f748995682711..8bfd7c8261e81ef3ca021d481854c63468289aa3 100644 (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));
         }
     }