]> git.mxchange.org Git - friendica.git/blob - src/Worker/APDelivery.php
Merge pull request #5903 from nupplaphil/move_module_acctlink
[friendica.git] / src / Worker / APDelivery.php
1 <?php
2 /**
3  * @file src/Worker/APDelivery.php
4  */
5 namespace Friendica\Worker;
6
7 use Friendica\BaseObject;
8 use Friendica\Protocol\ActivityPub;
9 use Friendica\Model\Item;
10 use Friendica\Util\HTTPSignature;
11
12 class APDelivery extends BaseObject
13 {
14         /**
15          * @brief Delivers ActivityPub messages
16          *
17          * @param string $cmd
18          * @param integer $item_id
19          * @param string $inbox
20          * @param integer $uid
21          */
22         public static function execute($cmd, $item_id, $inbox, $uid)
23         {
24                 logger('Invoked: ' . $cmd . ': ' . $item_id . ' to ' . $inbox, LOGGER_DEBUG);
25
26                 if ($cmd == Delivery::MAIL) {
27                 } elseif ($cmd == Delivery::SUGGESTION) {
28                         ActivityPub\Transmitter::sendContactSuggestion($uid, $inbox, $item_id);
29                 } elseif ($cmd == Delivery::RELOCATION) {
30                 } elseif ($cmd == Delivery::REMOVAL) {
31                         ActivityPub\Transmitter::sendProfileDeletion($uid, $inbox);
32                 } elseif ($cmd == Delivery::PROFILEUPDATE) {
33                         ActivityPub\Transmitter::sendProfileUpdate($uid, $inbox);
34                 } else {
35                         $data = ActivityPub\Transmitter::createCachedActivityFromItem($item_id);
36                         if (!empty($data)) {
37                                 HTTPSignature::transmit($data, $inbox, $uid);
38                         }
39                 }
40         }
41 }