]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/DFRN.php
The function is only needed in the same class
[friendica.git] / src / Protocol / DFRN.php
index 759f7f5f28b03c7596e7b42f607f88bfad67a1f5..1ab4d8f9e4959592cf887e9f09f651989de53455 100644 (file)
@@ -81,7 +81,8 @@ class DFRN
                                return [];
                        }
 
-                       $user['importer_uid']  = $user['uid'];
+                       $user['importer_uid'] = $user['uid'];
+                       $user['uprvkey'] = $user['prvkey'];
                } else {
                        $user = ['importer_uid' => 0, 'uprvkey' => '', 'timezone' => 'UTC',
                                'nickname' => '', 'sprvkey' => '', 'spubkey' => '',
@@ -1163,15 +1164,17 @@ 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
-               $ret = self::transmit($owner, $contact, $atom);
-               if ($ret >= 200) {
-                       logger('Delivery via Diaspora transport layer was successful with status ' . $ret);
-                       return $ret;
+               if (!$dissolve && !$legacy_transport) {
+                       $ret = self::transmit($owner, $contact, $atom);
+                       if ($ret >= 200) {
+                               logger('Delivery via Diaspora transport layer was successful with status ' . $ret);
+                               return $ret;
+                       }
                }
 
                $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
@@ -2407,8 +2410,11 @@ class DFRN
                                                break;
                                        case "enclosure":
                                                $enclosure = $href;
-                                               if (strlen($item["attach"])) {
+
+                                               if (!empty($item["attach"])) {
                                                        $item["attach"] .= ",";
+                                               } else {
+                                                       $item["attach"] = "";
                                                }
 
                                                $item["attach"] .= '[attach]href="' . $href . '" length="' . $length . '" type="' . $type . '" title="' . $title . '"[/attach]';