]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/DFRN.php
Spaces
[friendica.git] / src / Protocol / DFRN.php
index 3832e38e16990b6b34ad74d9cd2aa32350291836..1ab4d8f9e4959592cf887e9f09f651989de53455 100644 (file)
@@ -1164,12 +1164,12 @@ class DFRN
         * @return int Deliver status. Negative values mean an error.
         * @todo Add array type-hint for $owner, $contact
         */
-       public static function deliver($owner, $contact, $atom, $dissolve = false)
+       public static function deliver($owner, $contact, $atom, $dissolve = false, $legacy_transport = false)
        {
                $a = get_app();
 
                // At first try the Diaspora transport layer
-               if (!$dissolve) {
+               if (!$dissolve && !$legacy_transport) {
                        $ret = self::transmit($owner, $contact, $atom);
                        if ($ret >= 200) {
                                logger('Delivery via Diaspora transport layer was successful with status ' . $ret);
@@ -1280,7 +1280,10 @@ class DFRN
                        }
                }
 
-               if (empty($contact['prvkey']) && !empty($contact['pubkey'])) {
+               if (($contact['duplex'] && strlen($contact['pubkey']))
+                       || ($owner['page-flags'] == Contact::PAGE_COMMUNITY && strlen($contact['pubkey']))
+                       || ($contact['rel'] == Contact::SHARING && strlen($contact['pubkey']))
+               ) {
                        openssl_public_decrypt($sent_dfrn_id, $final_dfrn_id, $contact['pubkey']);
                        openssl_public_decrypt($challenge, $postvars['challenge'], $contact['pubkey']);
                } else {