Functionality is now split

This commit is contained in:
Michael 2018-10-03 09:15:38 +00:00
parent 4528d8748c
commit 3ab837f3c7
13 changed files with 71 additions and 1727 deletions

View file

@ -4848,66 +4848,65 @@ function api_share_as_retweet(&$item)
* we already checked this in diaspora::isReshare() * we already checked this in diaspora::isReshare()
* but better one more than one less... * but better one more than one less...
*/ */
if ($body == $attributes) { if (($body == $attributes) || empty($attributes)) {
return false; return false;
} }
// build the fake reshared item // build the fake reshared item
$reshared_item = $item; $reshared_item = $item;
$author = ""; $author = "";
preg_match("/author='(.*?)'/ism", $attributes, $matches); preg_match("/author='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") { if (!empty($matches[1])) {
$author = html_entity_decode($matches[1], ENT_QUOTES, 'UTF-8'); $author = html_entity_decode($matches[1], ENT_QUOTES, 'UTF-8');
} }
preg_match('/author="(.*?)"/ism', $attributes, $matches); preg_match('/author="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") { if (!empty($matches[1])) {
$author = $matches[1]; $author = $matches[1];
} }
$profile = ""; $profile = "";
preg_match("/profile='(.*?)'/ism", $attributes, $matches); preg_match("/profile='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") { if (!empty($matches[1])) {
$profile = $matches[1]; $profile = $matches[1];
} }
preg_match('/profile="(.*?)"/ism', $attributes, $matches); preg_match('/profile="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") { if (!empty($matches[1])) {
$profile = $matches[1]; $profile = $matches[1];
} }
$avatar = ""; $avatar = "";
preg_match("/avatar='(.*?)'/ism", $attributes, $matches); preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") { if (!empty($matches[1])) {
$avatar = $matches[1]; $avatar = $matches[1];
} }
preg_match('/avatar="(.*?)"/ism', $attributes, $matches); preg_match('/avatar="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") { if (!empty($matches[1])) {
$avatar = $matches[1]; $avatar = $matches[1];
} }
$link = ""; $link = "";
preg_match("/link='(.*?)'/ism", $attributes, $matches); preg_match("/link='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") { if (!empty($matches[1])) {
$link = $matches[1]; $link = $matches[1];
} }
preg_match('/link="(.*?)"/ism', $attributes, $matches); preg_match('/link="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") { if (!empty($matches[1])) {
$link = $matches[1]; $link = $matches[1];
} }
$posted = ""; $posted = "";
preg_match("/posted='(.*?)'/ism", $attributes, $matches); preg_match("/posted='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") { if (!empty($matches[1])) {
$posted = $matches[1]; $posted = $matches[1];
} }
preg_match('/posted="(.*?)"/ism', $attributes, $matches); preg_match('/posted="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") { if (!empty($matches[1])) {
$posted = $matches[1]; $posted = $matches[1];
} }

View file

@ -337,7 +337,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
); );
} else { } else {
if ($network == Protocol::ACTIVITYPUB) { if ($network == Protocol::ACTIVITYPUB) {
ActivityPub::transmitContactAccept($contact['url'], $contact['hub-verify'], $uid); ActivityPub\Transmitter::transmitContactAccept($contact['url'], $contact['hub-verify'], $uid);
$pending = true; $pending = true;
} else { } else {
$pending = false; $pending = false;
@ -394,7 +394,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
Group::addMember(User::getDefaultGroup($uid, $contact["network"]), $contact['id']); Group::addMember(User::getDefaultGroup($uid, $contact["network"]), $contact['id']);
if ($network == Protocol::ACTIVITYPUB && $duplex) { if ($network == Protocol::ACTIVITYPUB && $duplex) {
ActivityPub::transmitActivity('Follow', $contact['url'], $uid); ActivityPub\Transmitter::transmitActivity('Follow', $contact['url'], $uid);
} }
// Let's send our user to the contact editor in case they want to // Let's send our user to the contact editor in case they want to

View file

@ -53,7 +53,7 @@ function profile_init(App $a)
if (ActivityPub::isRequest()) { if (ActivityPub::isRequest()) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $which]); $user = DBA::selectFirst('user', ['uid'], ['nickname' => $which]);
if (DBA::isResult($user)) { if (DBA::isResult($user)) {
$data = ActivityPub::profile($user['uid']); $data = ActivityPub\Transmitter::profile($user['uid']);
echo json_encode($data); echo json_encode($data);
header('Content-Type: application/activity+json'); header('Content-Type: application/activity+json');
exit(); exit();

View file

@ -557,10 +557,10 @@ class Contact extends BaseObject
} elseif ($contact['network'] == Protocol::DIASPORA) { } elseif ($contact['network'] == Protocol::DIASPORA) {
Diaspora::sendUnshare($user, $contact); Diaspora::sendUnshare($user, $contact);
} elseif ($contact['network'] == Protocol::ACTIVITYPUB) { } elseif ($contact['network'] == Protocol::ACTIVITYPUB) {
ActivityPub::transmitContactUndo($contact['url'], $user['uid']); ActivityPub\Transmitter::transmitContactUndo($contact['url'], $user['uid']);
if ($dissolve) { if ($dissolve) {
ActivityPub::transmitContactReject($contact['url'], $contact['hub-verify'], $user['uid']); ActivityPub\Transmitter::transmitContactReject($contact['url'], $contact['hub-verify'], $user['uid']);
} }
} }
} }
@ -1769,7 +1769,7 @@ class Contact extends BaseObject
$ret = Diaspora::sendShare($a->user, $contact); $ret = Diaspora::sendShare($a->user, $contact);
logger('share returns: ' . $ret); logger('share returns: ' . $ret);
} elseif ($contact['network'] == Protocol::ACTIVITYPUB) { } elseif ($contact['network'] == Protocol::ACTIVITYPUB) {
$ret = ActivityPub::transmitActivity('Follow', $contact['url'], $uid); $ret = ActivityPub\Transmitter::transmitActivity('Follow', $contact['url'], $uid);
logger('Follow returns: ' . $ret); logger('Follow returns: ' . $ret);
} }
} }
@ -1846,7 +1846,7 @@ class Contact extends BaseObject
} }
if ($contact['network'] == Protocol::ACTIVITYPUB) { if ($contact['network'] == Protocol::ACTIVITYPUB) {
ActivityPub::transmitContactAccept($contact['url'], $contact['hub-verify'], $importer['uid']); ActivityPub\Transmitter::transmitContactAccept($contact['url'], $contact['hub-verify'], $importer['uid']);
} }
// send email notification to owner? // send email notification to owner?

View file

@ -48,7 +48,7 @@ class Inbox extends BaseModule
$uid = 0; $uid = 0;
} }
ActivityPub::processInbox($postdata, $_SERVER, $uid); ActivityPub\Receiver::processInbox($postdata, $_SERVER, $uid);
System::httpExit(202); System::httpExit(202);
} }

View file

@ -32,7 +32,7 @@ class Objects extends BaseModule
System::httpExit(404); System::httpExit(404);
} }
$data = ActivityPub::createObjectFromItemID($item['id']); $data = ActivityPub\Transmitter::createObjectFromItemID($item['id']);
header('Content-Type: application/activity+json'); header('Content-Type: application/activity+json');
echo json_encode($data); echo json_encode($data);

File diff suppressed because it is too large Load diff

View file

@ -116,7 +116,7 @@ class Processor
* @param array $activity * @param array $activity
* @param $body * @param $body
*/ */
private static function createItem($activity, $body) public static function createItem($activity, $body)
{ {
$item = []; $item = [];
$item['verb'] = ACTIVITY_POST; $item['verb'] = ACTIVITY_POST;
@ -144,7 +144,7 @@ class Processor
* @param array $activity * @param array $activity
* @param $body * @param $body
*/ */
private static function likeItem($activity, $body) public static function likeItem($activity, $body)
{ {
$item = []; $item = [];
$item['verb'] = ACTIVITY_LIKE; $item['verb'] = ACTIVITY_LIKE;
@ -161,7 +161,7 @@ class Processor
* @param array $activity * @param array $activity
* @param $body * @param $body
*/ */
private static function deleteItem($activity) public static function deleteItem($activity)
{ {
$owner = Contact::getIdForURL($activity['owner']); $owner = Contact::getIdForURL($activity['owner']);
$object = JsonLD::fetchElement($activity, 'object', 'id'); $object = JsonLD::fetchElement($activity, 'object', 'id');
@ -175,7 +175,7 @@ class Processor
* @param array $activity * @param array $activity
* @param $body * @param $body
*/ */
private static function dislikeItem($activity, $body) public static function dislikeItem($activity, $body)
{ {
$item = []; $item = [];
$item['verb'] = ACTIVITY_DISLIKE; $item['verb'] = ACTIVITY_DISLIKE;
@ -272,7 +272,7 @@ class Processor
$activity['published'] = $object['published']; $activity['published'] = $object['published'];
$activity['type'] = 'Create'; $activity['type'] = 'Create';
ActivityPub::processActivity($activity); ActivityPub\Receiver::processActivity($activity);
logger('Activity ' . $url . ' had been fetched and processed.'); logger('Activity ' . $url . ' had been fetched and processed.');
} }
@ -281,7 +281,7 @@ class Processor
* *
* @param array $activity * @param array $activity
*/ */
private static function followUser($activity) public static function followUser($activity)
{ {
$actor = JsonLD::fetchElement($activity, 'object', 'id'); $actor = JsonLD::fetchElement($activity, 'object', 'id');
$uid = User::getIdForURL($actor); $uid = User::getIdForURL($actor);
@ -321,7 +321,7 @@ class Processor
* *
* @param array $activity * @param array $activity
*/ */
private static function updatePerson($activity) public static function updatePerson($activity)
{ {
if (empty($activity['object']['id'])) { if (empty($activity['object']['id'])) {
return; return;
@ -336,7 +336,7 @@ class Processor
* *
* @param array $activity * @param array $activity
*/ */
private static function deletePerson($activity) public static function deletePerson($activity)
{ {
if (empty($activity['object']['id']) || empty($activity['object']['actor'])) { if (empty($activity['object']['id']) || empty($activity['object']['actor'])) {
logger('Empty object id or actor.', LOGGER_DEBUG); logger('Empty object id or actor.', LOGGER_DEBUG);
@ -362,7 +362,7 @@ class Processor
* *
* @param array $activity * @param array $activity
*/ */
private static function acceptFollowUser($activity) public static function acceptFollowUser($activity)
{ {
$actor = JsonLD::fetchElement($activity, 'object', 'actor'); $actor = JsonLD::fetchElement($activity, 'object', 'actor');
$uid = User::getIdForURL($actor); $uid = User::getIdForURL($actor);
@ -395,7 +395,7 @@ class Processor
* *
* @param array $activity * @param array $activity
*/ */
private static function rejectFollowUser($activity) public static function rejectFollowUser($activity)
{ {
$actor = JsonLD::fetchElement($activity, 'object', 'actor'); $actor = JsonLD::fetchElement($activity, 'object', 'actor');
$uid = User::getIdForURL($actor); $uid = User::getIdForURL($actor);
@ -424,7 +424,7 @@ class Processor
* *
* @param array $activity * @param array $activity
*/ */
private static function undoActivity($activity) public static function undoActivity($activity)
{ {
$activity_url = JsonLD::fetchElement($activity, 'object', 'id'); $activity_url = JsonLD::fetchElement($activity, 'object', 'id');
if (empty($activity_url)) { if (empty($activity_url)) {
@ -449,7 +449,7 @@ class Processor
* *
* @param array $activity * @param array $activity
*/ */
private static function undoFollowUser($activity) public static function undoFollowUser($activity)
{ {
$object = JsonLD::fetchElement($activity, 'object', 'object'); $object = JsonLD::fetchElement($activity, 'object', 'object');
$uid = User::getIdForURL($object); $uid = User::getIdForURL($object);

View file

@ -95,7 +95,7 @@ class Receiver
$trust_source = false; $trust_source = false;
} }
ActivityPub::processActivity($activity, $body, $uid, $trust_source); self::processActivity($activity, $body, $uid, $trust_source);
} }
/** /**
@ -116,7 +116,7 @@ class Receiver
} }
// Fetch all receivers from to, cc, bto and bcc // Fetch all receivers from to, cc, bto and bcc
$receivers = ActivityPub::getReceivers($activity, $actor); $receivers = self::getReceivers($activity, $actor);
// When it is a delivery to a personal inbox we add that user to the receivers // When it is a delivery to a personal inbox we add that user to the receivers
if (!empty($uid)) { if (!empty($uid)) {
@ -135,7 +135,7 @@ class Receiver
// Fetch the content only on activities where this matters // Fetch the content only on activities where this matters
if (in_array($activity['type'], ['Create', 'Announce'])) { if (in_array($activity['type'], ['Create', 'Announce'])) {
$object_data = ActivityPub::fetchObject($object_id, $activity['object'], $trust_source); $object_data = self::fetchObject($object_id, $activity['object'], $trust_source);
if (empty($object_data)) { if (empty($object_data)) {
logger("Object data couldn't be processed", LOGGER_DEBUG); logger("Object data couldn't be processed", LOGGER_DEBUG);
return []; return [];
@ -145,7 +145,7 @@ class Receiver
} elseif (in_array($activity['type'], ['Like', 'Dislike'])) { } elseif (in_array($activity['type'], ['Like', 'Dislike'])) {
// Create a mostly empty array out of the activity data (instead of the object). // Create a mostly empty array out of the activity data (instead of the object).
// This way we later don't have to check for the existence of ech individual array element. // This way we later don't have to check for the existence of ech individual array element.
$object_data = ActivityPub::processObject($activity); $object_data = self::processObject($activity);
$object_data['name'] = $activity['type']; $object_data['name'] = $activity['type'];
$object_data['author'] = $activity['actor']; $object_data['author'] = $activity['actor'];
$object_data['object'] = $object_id; $object_data['object'] = $object_id;
@ -157,7 +157,7 @@ class Receiver
$object_data['object_type'] = JsonLD::fetchElement($activity, 'object', 'type'); $object_data['object_type'] = JsonLD::fetchElement($activity, 'object', 'type');
} }
$object_data = ActivityPub::addActivityFields($object_data, $activity); $object_data = self::addActivityFields($object_data, $activity);
$object_data['type'] = $activity['type']; $object_data['type'] = $activity['type'];
$object_data['owner'] = $actor; $object_data['owner'] = $actor;
@ -176,7 +176,7 @@ class Receiver
* @param integer $uid User ID * @param integer $uid User ID
* @param $trust_source * @param $trust_source
*/ */
private static function processActivity($activity, $body = '', $uid = null, $trust_source = false) public static function processActivity($activity, $body = '', $uid = null, $trust_source = false)
{ {
if (empty($activity['type'])) { if (empty($activity['type'])) {
logger('Empty type', LOGGER_DEBUG); logger('Empty type', LOGGER_DEBUG);
@ -195,7 +195,7 @@ class Receiver
} }
// $trust_source is called by reference and is set to true if the content was retrieved successfully // $trust_source is called by reference and is set to true if the content was retrieved successfully
$object_data = ActivityPub::prepareObjectData($activity, $uid, $trust_source); $object_data = self::prepareObjectData($activity, $uid, $trust_source);
if (empty($object_data)) { if (empty($object_data)) {
logger('No object data found', LOGGER_DEBUG); logger('No object data found', LOGGER_DEBUG);
return; return;
@ -208,54 +208,54 @@ class Receiver
switch ($activity['type']) { switch ($activity['type']) {
case 'Create': case 'Create':
case 'Announce': case 'Announce':
ActivityPub::createItem($object_data, $body); ActivityPub\Processor::createItem($object_data, $body);
break; break;
case 'Like': case 'Like':
ActivityPub::likeItem($object_data, $body); ActivityPub\Processor::likeItem($object_data, $body);
break; break;
case 'Dislike': case 'Dislike':
ActivityPub::dislikeItem($object_data, $body); ActivityPub\Processor::dislikeItem($object_data, $body);
break; break;
case 'Update': case 'Update':
if (in_array($object_data['object_type'], ActivityPub::CONTENT_TYPES)) { if (in_array($object_data['object_type'], ActivityPub::CONTENT_TYPES)) {
/// @todo /// @todo
} elseif (in_array($object_data['object_type'], ActivityPub::ACCOUNT_TYPES)) { } elseif (in_array($object_data['object_type'], ActivityPub::ACCOUNT_TYPES)) {
ActivityPub::updatePerson($object_data, $body); ActivityPub\Processor::updatePerson($object_data, $body);
} }
break; break;
case 'Delete': case 'Delete':
if ($object_data['object_type'] == 'Tombstone') { if ($object_data['object_type'] == 'Tombstone') {
ActivityPub::deleteItem($object_data, $body); ActivityPub\Processor::deleteItem($object_data, $body);
} elseif (in_array($object_data['object_type'], ActivityPub::ACCOUNT_TYPES)) { } elseif (in_array($object_data['object_type'], ActivityPub::ACCOUNT_TYPES)) {
ActivityPub::deletePerson($object_data, $body); ActivityPub\Processor::deletePerson($object_data, $body);
} }
break; break;
case 'Follow': case 'Follow':
ActivityPub::followUser($object_data); ActivityPub\Processor::followUser($object_data);
break; break;
case 'Accept': case 'Accept':
if ($object_data['object_type'] == 'Follow') { if ($object_data['object_type'] == 'Follow') {
ActivityPub::acceptFollowUser($object_data); ActivityPub\Processor::acceptFollowUser($object_data);
} }
break; break;
case 'Reject': case 'Reject':
if ($object_data['object_type'] == 'Follow') { if ($object_data['object_type'] == 'Follow') {
ActivityPub::rejectFollowUser($object_data); ActivityPub\Processor::rejectFollowUser($object_data);
} }
break; break;
case 'Undo': case 'Undo':
if ($object_data['object_type'] == 'Follow') { if ($object_data['object_type'] == 'Follow') {
ActivityPub::undoFollowUser($object_data); ActivityPub\Processor::undoFollowUser($object_data);
} elseif (in_array($object_data['object_type'], ActivityPub::ACTIVITY_TYPES)) { } elseif (in_array($object_data['object_type'], ActivityPub::ACTIVITY_TYPES)) {
ActivityPub::undoActivity($object_data); ActivityPub\Processor::undoActivity($object_data);
} }
break; break;
@ -346,7 +346,7 @@ class Receiver
} }
} }
ActivityPub::switchContacts($receivers, $actor); self::switchContacts($receivers, $actor);
return $receivers; return $receivers;
} }
@ -392,12 +392,12 @@ class Receiver
foreach ($receivers as $receiver) { foreach ($receivers as $receiver) {
$contact = DBA::selectFirst('contact', ['id'], ['uid' => $receiver, 'network' => Protocol::OSTATUS, 'nurl' => normalise_link($actor)]); $contact = DBA::selectFirst('contact', ['id'], ['uid' => $receiver, 'network' => Protocol::OSTATUS, 'nurl' => normalise_link($actor)]);
if (DBA::isResult($contact)) { if (DBA::isResult($contact)) {
ActivityPub::switchContact($contact['id'], $receiver, $actor); self::switchContact($contact['id'], $receiver, $actor);
} }
$contact = DBA::selectFirst('contact', ['id'], ['uid' => $receiver, 'network' => Protocol::OSTATUS, 'alias' => [normalise_link($actor), $actor]]); $contact = DBA::selectFirst('contact', ['id'], ['uid' => $receiver, 'network' => Protocol::OSTATUS, 'alias' => [normalise_link($actor), $actor]]);
if (DBA::isResult($contact)) { if (DBA::isResult($contact)) {
ActivityPub::switchContact($contact['id'], $receiver, $actor); self::switchContact($contact['id'], $receiver, $actor);
} }
} }
} }
@ -461,7 +461,7 @@ class Receiver
return false; return false;
} }
logger('Using already stored item for url ' . $object_id, LOGGER_DEBUG); logger('Using already stored item for url ' . $object_id, LOGGER_DEBUG);
$data = ActivityPub::createNote($item); $data = ActivityPub\Transmitter::createNote($item);
} }
if (empty($data['type'])) { if (empty($data['type'])) {
@ -470,14 +470,14 @@ class Receiver
} }
if (in_array($data['type'], ActivityPub::CONTENT_TYPES)) { if (in_array($data['type'], ActivityPub::CONTENT_TYPES)) {
return ActivityPub::processObject($data); return self::processObject($data);
} }
if ($data['type'] == 'Announce') { if ($data['type'] == 'Announce') {
if (empty($data['object'])) { if (empty($data['object'])) {
return false; return false;
} }
return ActivityPub::fetchObject($data['object']); return self::fetchObject($data['object']);
} }
logger('Unhandled object type: ' . $data['type'], LOGGER_DEBUG); logger('Unhandled object type: ' . $data['type'], LOGGER_DEBUG);
@ -533,7 +533,7 @@ class Receiver
$object_data['tags'] = defaults($object, 'tag', null); $object_data['tags'] = defaults($object, 'tag', null);
$object_data['service'] = JsonLD::fetchElement($object, 'instrument', 'name', 'type', 'Service'); $object_data['service'] = JsonLD::fetchElement($object, 'instrument', 'name', 'type', 'Service');
$object_data['alternate-url'] = JsonLD::fetchElement($object, 'url', 'href'); $object_data['alternate-url'] = JsonLD::fetchElement($object, 'url', 'href');
$object_data['receiver'] = ActivityPub::getReceivers($object, $object_data['owner']); $object_data['receiver'] = self::getReceivers($object, $object_data['owner']);
// Common object data: // Common object data:
@ -560,37 +560,4 @@ class Receiver
return $object_data; return $object_data;
} }
/**
* @brief
*
* @param $url
* @param $child
*/
private static function fetchMissingActivity($url, $child)
{
if (Config::get('system', 'ostatus_full_threads')) {
return;
}
$object = ActivityPub::fetchContent($url);
if (empty($object)) {
logger('Activity ' . $url . ' was not fetchable, aborting.');
return;
}
$activity = [];
$activity['@context'] = $object['@context'];
unset($object['@context']);
$activity['id'] = $object['id'];
$activity['to'] = defaults($object, 'to', []);
$activity['cc'] = defaults($object, 'cc', []);
$activity['actor'] = $child['author'];
$activity['object'] = $object;
$activity['published'] = $object['published'];
$activity['type'] = 'Create';
ActivityPub::processActivity($activity);
logger('Activity ' . $url . ' had been fetched and processed.');
}
} }

View file

@ -283,7 +283,7 @@ class Transmitter
* *
* @return permission array * @return permission array
*/ */
public static function createPermissionBlockForItem($item) private static function createPermissionBlockForItem($item)
{ {
$data = ['to' => [], 'cc' => []]; $data = ['to' => [], 'cc' => []];
@ -684,7 +684,7 @@ class Transmitter
'id' => System::baseUrl() . '/activity/' . System::createGUID(), 'id' => System::baseUrl() . '/activity/' . System::createGUID(),
'type' => 'Delete', 'type' => 'Delete',
'actor' => $owner['url'], 'actor' => $owner['url'],
'object' => self::profile($uid), 'object' => $owner['url'],
'published' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), 'published' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
'to' => [ActivityPub::PUBLIC_COLLECTION], 'to' => [ActivityPub::PUBLIC_COLLECTION],
'cc' => []]; 'cc' => []];

View file

@ -19,11 +19,11 @@ class APDelivery extends BaseObject
} elseif ($cmd == Delivery::SUGGESTION) { } elseif ($cmd == Delivery::SUGGESTION) {
} elseif ($cmd == Delivery::RELOCATION) { } elseif ($cmd == Delivery::RELOCATION) {
} elseif ($cmd == Delivery::REMOVAL) { } elseif ($cmd == Delivery::REMOVAL) {
ActivityPub::transmitProfileDeletion($uid, $inbox); ActivityPub\Transmitter::transmitProfileDeletion($uid, $inbox);
} elseif ($cmd == Delivery::PROFILEUPDATE) { } elseif ($cmd == Delivery::PROFILEUPDATE) {
ActivityPub::transmitProfileUpdate($uid, $inbox); ActivityPub\Transmitter::transmitProfileUpdate($uid, $inbox);
} else { } else {
$data = ActivityPub::createActivityFromItem($item_id); $data = ActivityPub\Transmitter::createActivityFromItem($item_id);
if (!empty($data)) { if (!empty($data)) {
HTTPSignature::transmit($data, $inbox, $uid); HTTPSignature::transmit($data, $inbox, $uid);
} }

View file

@ -100,7 +100,7 @@ class Notifier
Contact::terminateFriendship($user, $contact, true); Contact::terminateFriendship($user, $contact, true);
} }
$inboxes = ActivityPub::fetchTargetInboxesforUser(0); $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser(0);
foreach ($inboxes as $inbox) { foreach ($inboxes as $inbox) {
logger('Account removal for user ' . $uid . ' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG); logger('Account removal for user ' . $uid . ' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG);
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true], Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
@ -425,11 +425,11 @@ class Notifier
$inboxes = []; $inboxes = [];
if ($target_item['origin']) { if ($target_item['origin']) {
$inboxes = ActivityPub::fetchTargetInboxes($target_item, $uid); $inboxes = ActivityPub\Transmitter::fetchTargetInboxes($target_item, $uid);
} }
if ($parent['origin']) { if ($parent['origin']) {
$parent_inboxes = ActivityPub::fetchTargetInboxes($parent, $uid); $parent_inboxes = ActivityPub\Transmitter::fetchTargetInboxes($parent, $uid);
$inboxes = array_merge($inboxes, $parent_inboxes); $inboxes = array_merge($inboxes, $parent_inboxes);
} }

View file

@ -19,7 +19,7 @@ class ProfileUpdate {
$a = BaseObject::getApp(); $a = BaseObject::getApp();
$inboxes = ActivityPub::fetchTargetInboxesforUser($uid); $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid);
foreach ($inboxes as $inbox) { foreach ($inboxes as $inbox) {
logger('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG); logger('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG);