- if (! DBM::is_result($r)) {
- logger('pubsub: no contact record for "'.$nick.' ('.$contact_id.')" - ignored. '.$xml);
- hub_post_return();
+ if (!DBM::is_result($r)) {
+ $author = OStatus::salmonAuthor($xml, $importer);
+ if (!empty($author['contact-id'])) {
+ $contact = dba::selectFirst('contact', [], ['id' => $author['contact-id']]);
+ if (!in_array($contact['rel'], [CONTACT_IS_SHARING, CONTACT_IS_FRIEND]) && ($contact['network'] != NETWORK_FEED)) {
+ logger('Contact ' . $author['contact-id'] . ' is not expected to share with us - ignored.');
+ hub_post_return();
+ }
+ logger('pubsub: no contact record for "'.$nick.' ('.$contact_id.')" - using '.$author['contact-id'].' instead.');
+ }
+ } else {
+ $contact = $r[0];