Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
1.3 KiB

<?php
/**
* @file src/Worker/APDelivery.php
*/
namespace Friendica\Worker;
use Friendica\BaseObject;
use Friendica\Core\Logger;
use Friendica\Core\Worker;
use Friendica\Protocol\ActivityPub;
use Friendica\Model\Item;
use Friendica\Util\HTTPSignature;
class APDelivery extends BaseObject
{
/**
* @brief Delivers ActivityPub messages
*
* @param string $cmd
* @param integer $item_id
* @param string $inbox
* @param integer $uid
*/
public static function execute($cmd, $item_id, $inbox, $uid)
{
Logger::log('Invoked: ' . $cmd . ': ' . $item_id . ' to ' . $inbox, Logger::DEBUG);
$success = true;
if ($cmd == Delivery::MAIL) {
} elseif ($cmd == Delivery::SUGGESTION) {
$success = ActivityPub\Transmitter::sendContactSuggestion($uid, $inbox, $item_id);
} elseif ($cmd == Delivery::RELOCATION) {
} elseif ($cmd == Delivery::REMOVAL) {
$success = ActivityPub\Transmitter::sendProfileDeletion($uid, $inbox);
} elseif ($cmd == Delivery::PROFILEUPDATE) {
$success = ActivityPub\Transmitter::sendProfileUpdate($uid, $inbox);
} else {
$data = ActivityPub\Transmitter::createCachedActivityFromItem($item_id);
if (!empty($data)) {
$success = HTTPSignature::transmit($data, $inbox, $uid);
}
}
if (!$success) {
Worker::defer();
}
}
}