]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/Diaspora.php
Delay unprepared posts
[friendica.git] / src / Protocol / Diaspora.php
index 7ab41eb52b08ea6bd1b2d9bdbf41e442df4b5f65..5f28e092d5798ab751c701a1c412eeca50ae5cfa 100644 (file)
@@ -3031,7 +3031,18 @@ class Diaspora
                        $owner['uprvkey'] = $owner['prvkey'];
                }
 
-               $envelope = self::buildMessage($msg, $owner, $contact, $owner['uprvkey'], $contact['pubkey'], $public_batch);
+               // When sending content to Friendica contacts using the Diaspora protocol
+               // we have to fetch the public key from the fcontact.
+               // This is due to the fact that legacy DFRN had unique keys for every contact.
+               $pubkey = $contact['pubkey'];
+               if (!empty($contact['addr'])) {
+                       $fcontact = FContact::getByURL($contact['addr']);
+                       if (!empty($fcontact)) {
+                               $pubkey = $fcontact['pubkey'];
+                       }
+               }
+
+               $envelope = self::buildMessage($msg, $owner, $contact, $owner['uprvkey'], $pubkey, $public_batch);
 
                $return_code = self::transmit($owner, $contact, $envelope, $public_batch, $guid);
 
@@ -3371,7 +3382,6 @@ class Diaspora
                        }
 
                        if ($item['author-link'] != $item['owner-link']) {
-                               require_once 'mod/share.php';
                                $body = BBCode::getShareOpeningTag($item['author-name'], $item['author-link'], $item['author-avatar'],
                                        $item['plink'], $item['created']) . $body . '[/share]';
                        }