X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdiaspora.php;h=545edcc4bf11a848726589823fc66906d030850a;hb=81c87885cf61247608a0fa8e738707510e737ace;hp=0c3ff68da46c0cba78f7123149da574ee82ee1ec;hpb=eb0a7015905a898bbdd0cbf865c29496a537d85c;p=friendica.git diff --git a/include/diaspora.php b/include/diaspora.php index 0c3ff68da4..545edcc4bf 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -8,11 +8,12 @@ * This will change in the future. */ -use \Friendica\Core\Config; +use Friendica\App; +use Friendica\Core\Config; require_once 'include/items.php'; require_once 'include/bb2diaspora.php'; -require_once 'include/Scrape.php'; +require_once 'include/probe.php'; require_once 'include/Contact.php'; require_once 'include/Photo.php'; require_once 'include/socgraph.php'; @@ -1394,7 +1395,7 @@ class Diaspora { $message_id = self::message_exists($importer["uid"], $guid); if ($message_id) { - return $message_id; + return true; } $parent_item = self::parent_item($importer["uid"], $parent_guid, $author, $contact); @@ -1453,6 +1454,10 @@ class Diaspora { $message_id = item_store($datarray); + if ($message_id <= 0) { + return false; + } + if ($message_id) { logger("Stored comment ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG); } @@ -1471,7 +1476,7 @@ class Diaspora { proc_run(PRIORITY_HIGH, "include/notifier.php", "comment-import", $message_id); } - return $message_id; + return true; } /** @@ -1516,8 +1521,9 @@ class Diaspora { $person = self::person_by_handle($msg_author); - $r = q("SELECT `id` FROM `mail` WHERE `uri` = '%s' LIMIT 1", - dbesc($message_uri) + $r = q("SELECT `id` FROM `mail` WHERE `guid` = '%s' AND `uid` = %d LIMIT 1", + dbesc($msg_guid), + intval($importer["uid"]) ); if (dbm::is_result($r)) { logger("duplicate message already delivered.", LOGGER_DEBUG); @@ -1621,7 +1627,7 @@ class Diaspora { } if (!$conversation) { logger("unable to create conversation."); - return; + return false; } foreach ($messages as $mesg) @@ -1699,7 +1705,7 @@ class Diaspora { $message_id = self::message_exists($importer["uid"], $guid); if ($message_id) - return $message_id; + return true; $parent_item = self::parent_item($importer["uid"], $parent_guid, $author, $contact); if (!$parent_item) @@ -1752,8 +1758,13 @@ class Diaspora { $message_id = item_store($datarray); - if ($message_id) + if ($message_id <= 0) { + return false; + } + + if ($message_id) { logger("Stored like ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG); + } // If we are the origin of the parent we store the original data and notify our followers if ($message_id AND $parent_item["origin"]) { @@ -1769,7 +1780,7 @@ class Diaspora { proc_run(PRIORITY_HIGH, "include/notifier.php", "comment-import", $message_id); } - return $message_id; + return true; } /** @@ -1813,8 +1824,8 @@ class Diaspora { return false; } - $r = q("SELECT `id` FROM `mail` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", - dbesc($message_uri), + $r = q("SELECT `id` FROM `mail` WHERE `guid` = '%s' AND `uid` = %d LIMIT 1", + dbesc($guid), intval($importer["uid"]) ); if (dbm::is_result($r)) { @@ -2346,7 +2357,7 @@ class Diaspora { $message_id = self::message_exists($importer["uid"], $guid); if ($message_id) { - return $message_id; + return true; } $original_item = self::original_item($root_guid, $root_author, $author); @@ -2397,9 +2408,10 @@ class Diaspora { if ($message_id) { logger("Stored reshare ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG); + return true; + } else { + return false; } - - return $message_id; } /** @@ -2530,7 +2542,7 @@ class Diaspora { $message_id = self::message_exists($importer["uid"], $guid); if ($message_id) { - return $message_id; + return true; } $address = array(); @@ -2614,9 +2626,10 @@ class Diaspora { if ($message_id) { logger("Stored item ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG); + return true; + } else { + return false; } - - return $message_id; } /* ************************************************************************************** * @@ -3819,4 +3832,3 @@ class Diaspora { return true; } } -?>