+ $receivers = [];
+ $networks = Protocol::FEDERATED;
+ $condition = ['nurl' => Strings::normaliseLink($actor), 'rel' => [Contact::SHARING, Contact::FRIEND, Contact::FOLLOWER],
+ 'network' => $networks, 'archive' => false, 'pending' => false];
+ $contacts = DBA::select('contact', ['uid', 'rel'], $condition);
+ while ($contact = DBA::fetch($contacts)) {
+ if (self::isValidReceiverForActor($contact, $actor, $tags)) {
+ $receivers['uid:' . $contact['uid']] = $contact['uid'];
+ }
+ }
+ DBA::close($contacts);
+ return $receivers;
+ }
+
+ /**
+ * Tests if the contact is a valid receiver for this actor
+ *
+ * @param array $contact
+ * @param string $actor
+ * @param array $tags
+ *
+ * @return bool with receivers (user id)
+ * @throws \Exception
+ */
+ private static function isValidReceiverForActor($contact, $actor, $tags)
+ {
+ // Public contacts are no valid receiver
+ if ($contact['uid'] == 0) {
+ return false;