+ /**
+ * Checks if the current delivery process needs to be transported via DFRN.
+ *
+ * @param array $contact Receiver of the post
+ * @param array $item The post
+ * @param string $cmd Notifier command
+ * @return bool
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ * @throws \ImagickException
+ */
+ private static function skipDFRN($contact, $item, $cmd)
+ {
+ // Don't skip when author or owner don't have AP profiles
+ if ((!empty($item['author-link']) && empty(APContact::getByURL($item['author-link'], false))) || (!empty($item['owner-link']) && empty(APContact::getByURL($item['owner-link'], false)))) {
+ return false;
+ }
+
+ // Don't skip DFRN delivery for these commands
+ if (in_array($cmd, [Delivery::SUGGESTION, Delivery::REMOVAL, Delivery::RELOCATION, Delivery::POKE])) {
+ return false;
+ }
+
+ // Skip DFRN when the item will be (forcefully) delivered via AP
+ if (Config::get('debug', 'total_ap_delivery') && ($contact['network'] == Protocol::DFRN) && !empty(APContact::getByURL($contact['url'], false))) {
+ return true;
+ }
+
+ // Skip DFRN delivery if the contact speaks ActivityPub
+ return in_array($contact['network'], [Protocol::DFRN, Protocol::DIASPORA]) && ($contact['protocol'] == Protocol::ACTIVITYPUB);
+ }
+