Preparation for relay posts with DFRN
This commit is contained in:
parent
4904be0d6f
commit
9f5a6c05fb
|
@ -1405,25 +1405,27 @@ class DFRN
|
||||||
{
|
{
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
if (empty($contact['addr'])) {
|
if (!$public_batch) {
|
||||||
logger('Empty contact handle for ' . $contact['id'] . ' - ' . $contact['url'] . ' - trying to update it.');
|
|
||||||
if (Contact::updateFromProbe($contact['id'])) {
|
|
||||||
$new_contact = dba::selectFirst('contact', ['addr'], ['id' => $contact['id']]);
|
|
||||||
$contact['addr'] = $new_contact['addr'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($contact['addr'])) {
|
if (empty($contact['addr'])) {
|
||||||
logger('Unable to find contact handle for ' . $contact['id'] . ' - ' . $contact['url']);
|
logger('Empty contact handle for ' . $contact['id'] . ' - ' . $contact['url'] . ' - trying to update it.');
|
||||||
Contact::markForArchival($contact);
|
if (Contact::updateFromProbe($contact['id'])) {
|
||||||
return -21;
|
$new_contact = dba::selectFirst('contact', ['addr'], ['id' => $contact['id']]);
|
||||||
}
|
$contact['addr'] = $new_contact['addr'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$fcontact = Diaspora::personByHandle($contact['addr']);
|
if (empty($contact['addr'])) {
|
||||||
if (empty($fcontact)) {
|
logger('Unable to find contact handle for ' . $contact['id'] . ' - ' . $contact['url']);
|
||||||
logger('Unable to find contact details for ' . $contact['id'] . ' - ' . $contact['addr']);
|
Contact::markForArchival($contact);
|
||||||
Contact::markForArchival($contact);
|
return -21;
|
||||||
return -22;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$fcontact = Diaspora::personByHandle($contact['addr']);
|
||||||
|
if (empty($fcontact)) {
|
||||||
|
logger('Unable to find contact details for ' . $contact['id'] . ' - ' . $contact['addr']);
|
||||||
|
Contact::markForArchival($contact);
|
||||||
|
return -22;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$envelope = Diaspora::buildMessage($atom, $owner, $contact, $owner['uprvkey'], $fcontact['pubkey'], $public_batch);
|
$envelope = Diaspora::buildMessage($atom, $owner, $contact, $owner['uprvkey'], $fcontact['pubkey'], $public_batch);
|
||||||
|
|
|
@ -269,7 +269,10 @@ class Delivery extends BaseObject {
|
||||||
// We don't have a relationship with contacts on a public post.
|
// We don't have a relationship with contacts on a public post.
|
||||||
// Se we transmit with the new method and via Diaspora as a fallback
|
// Se we transmit with the new method and via Diaspora as a fallback
|
||||||
if ($items[0]['uid'] == 0) {
|
if ($items[0]['uid'] == 0) {
|
||||||
$deliver_status = DFRN::transmit($owner, $contact, $atom);
|
// Transmit in public if it's a relay post
|
||||||
|
$public_dfrn = ($contact['contact-type'] == ACCOUNT_TYPE_RELAY);
|
||||||
|
|
||||||
|
$deliver_status = DFRN::transmit($owner, $contact, $atom, $public_dfrn);
|
||||||
if (($deliver_status < 200) || ($deliver_status > 299)) {
|
if (($deliver_status < 200) || ($deliver_status > 299)) {
|
||||||
// Transmit via Diaspora if not possible via Friendica
|
// Transmit via Diaspora if not possible via Friendica
|
||||||
self::deliverDiaspora($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup);
|
self::deliverDiaspora($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user