use Friendica\Protocol\DFRN;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\Email;
+use Friendica\Protocol\Activity;
use Friendica\Util\Strings;
use Friendica\Util\Network;
use Friendica\Core\Worker;
*/
private static function deliverDFRN($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup)
{
+ // Transmit Diaspora reshares via Diaspora if the Friendica contact support Diaspora
+ if (Diaspora::isReshare($target_item['body']) && !empty(Diaspora::personByHandle($contact['addr'], false))) {
+ Logger::info('Reshare will be transmitted via Diaspora', ['url' => $contact['url'], 'guid' => ($target_item['guid'] ?? '') ?: $target_item['id']]);
+ self::deliverDiaspora($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup);
+ return;
+ }
+
Logger::info('Deliver ' . (($target_item['guid'] ?? '') ?: $target_item['id']) . ' via DFRN to ' . (($contact['addr'] ?? '') ?: $contact['url']));
if ($cmd == self::MAIL) {
* @param array $contact Contact record of the receiver
* @param array $owner Owner record of the sender
* @param array $target_item Item record of the content
- * @param array $thr_parent Item record of the thread parent
+ * @param array $thr_parent Item record of the direct parent in the thread
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
if (Config::get('system','dfrn_only')) {
return;
}
- // WARNING: does not currently convert to RFC2047 header encodings, etc.
$addr = $contact['addr'];
if (!strlen($addr)) {
return;
}
+ if ($target_item['verb'] != Activity::POST) {
+ return;
+ }
+
if (!empty($thr_parent['object'])) {
$data = json_decode($thr_parent['object'], true);
if (!empty($data['reply_to'])) {
if ($target_item['uri'] !== $target_item['parent-uri']) {
$headers .= 'References: <' . Email::iri2msgid($target_item['parent-uri']) . '>';
- // If Threading is enabled, write down the correct parent
+ // Export more references on deeper nested threads
if (($target_item['thr-parent'] != '') && ($target_item['thr-parent'] != $target_item['parent-uri'])) {
$headers .= ' <' . Email::iri2msgid($target_item['thr-parent']) . '>';
}
Email::send($addr, $subject, $headers, $target_item);
- Model\ItemDeliveryData::incrementQueueFailed($target_item['id']);
+ Model\ItemDeliveryData::incrementQueueDone($target_item['id'], Model\ItemDeliveryData::MAIL);
Logger::info('Delivered via mail', ['guid' => $target_item['guid'], 'to' => $addr, 'subject' => $subject]);
}