X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FDFRN.php;h=df974729bab07261d01cfe7b8645d167727391cc;hb=7c138dd15c0c28a480f06feaedfa09916ba8461f;hp=7cb9db1a136d2d4834bc8ad8ef24ea63011f75cf;hpb=a6423031eba1236127160ced3028e36401f40536;p=friendica.git diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 7cb9db1a13..df974729ba 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -1,6 +1,6 @@ setAttribute("xmlns:statusnet", ActivityNamespace::STATUSNET); } + $body = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']); + if ($item['private'] == Item::PRIVATE) { - $body = Item::fixPrivatePhotos($item['body'], $owner['uid'], $item, $cid); - } else { - $body = $item['body']; + $body = Item::fixPrivatePhotos($body, $owner['uid'], $item, $cid); } // Remove the abstract element. It is only locally important. @@ -2194,6 +2195,12 @@ class DFRN $item["title"] = XML::getFirstNodeValue($xpath, "atom:title/text()", $entry); + if (!empty($item["title"])) { + $item["post-type"] = Item::PT_ARTICLE; + } else { + $item["post-type"] = Item::PT_NOTE; + } + $item["created"] = XML::getFirstNodeValue($xpath, "atom:published/text()", $entry); $item["body"] = XML::getFirstNodeValue($xpath, "dfrn:env/text()", $entry); @@ -2238,6 +2245,8 @@ class DFRN $item['uri-id'] = ItemURI::insert(['uri' => $item['uri'], 'guid' => $item['guid']]); + $item["body"] = Item::improveSharedDataInBody($item); + Tag::storeFromBody($item['uri-id'], $item["body"]); // We store the data from "dfrn:diaspora_signature" in a different table, this is done in "Item::insert" @@ -2333,7 +2342,7 @@ class DFRN return 403; } } - + // Get the type of the item (Top level post, reply or remote reply) $entrytype = self::getEntryType($importer, $item); @@ -2425,8 +2434,8 @@ class DFRN if (in_array($entrytype, [DFRN::REPLY, DFRN::REPLY_RC])) { // Will be overwritten for sharing accounts in Item::insert - if (empty($item['post-type']) && ($entrytype == DFRN::REPLY)) { - $item['post-type'] = Item::PT_COMMENT; + if (empty($item['post-reason']) && ($entrytype == DFRN::REPLY)) { + $item['post-reason'] = Item::PR_COMMENT; } $posted_id = Item::insert($item); @@ -2587,7 +2596,7 @@ class DFRN $header["direction"] = $direction; if ($direction === Conversation::RELAY) { - $header['post-type'] = Item::PT_RELAY; + $header['post-reason'] = Item::PR_RELAY; } // Update the contact table if the data has changed @@ -2604,6 +2613,14 @@ class DFRN Logger::log("Import DFRN message for user " . $importer["importer_uid"] . " from contact " . $importer["id"], Logger::DEBUG); + if (!empty($importer['gsid'])) { + if ($protocol == Conversation::PARCEL_DIASPORA_DFRN) { + GServer::setProtocol($importer['gsid'], Post\DeliveryData::DFRN); + } elseif ($protocol == Conversation::PARCEL_LEGACY_DFRN) { + GServer::setProtocol($importer['gsid'], Post\DeliveryData::LEGACY_DFRN); + } + } + // is it a public forum? Private forums aren't exposed with this method $forum = intval(XML::getFirstNodeValue($xpath, "/atom:feed/dfrn:community/text()"));