require_once('include/files.php');
require_once('include/text.php');
require_once('include/email.php');
-//require_once('include/ostatus_conversation.php');
require_once('include/threads.php');
require_once('include/socgraph.php');
require_once('include/plaintext.php');
// but for now let's just find any author photo
// Additionally we look for an alternate author link. On OStatus this one is the one we want.
- // Search for ostatus conversation url
$authorlinks = $item->feed->data["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["feed"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["author"][0]["child"]["http://www.w3.org/2005/Atom"]["link"];
if (is_array($authorlinks)) {
foreach ($authorlinks as $link) {
}
}
-// // Search for ostatus conversation url
-// $links = $item->feed->data["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["feed"][0]["child"][SIMPLEPIE_NAMESPACE_ATOM_10]["entry"][0]["child"]["http://www.w3.org/2005/Atom"]["link"];
-//
-// if (is_array($links)) {
-// foreach ($links as $link) {
-// $conversation = array_shift($link["attribs"]);
-//
-// if ($conversation["rel"] == "ostatus:conversation") {
-// $res["ostatus_conversation"] = ostatus_convert_href($conversation["href"]);
-// logger('get_atom_elements: found conversation url '.$res["ostatus_conversation"]);
-// //} elseif ($conversation["rel"] == "alternate") {
-// // $res["plink"] = $conversation["href"];
-// // logger('get_atom_elements: found plink '.$res["plink"]);
-// }
-// };
-// }
-
if (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND $contact['fetch_further_information']) {
$preview = "";
$arr['plink'] = ostatus_convert_href($arr['uri']);
}
-// // if an OStatus conversation url was passed in, it is stored and then
-// // removed from the array.
-// $ostatus_conversation = null;
-
-// if (isset($arr["ostatus_conversation"])) {
-// $ostatus_conversation = $arr["ostatus_conversation"];
-// unset($arr["ostatus_conversation"]);
-// }
-
if(x($arr, 'gravity'))
$arr['gravity'] = intval($arr['gravity']);
elseif($arr['parent-uri'] === $arr['uri'])
intval($current_post)
);
- // Complete ostatus threads
- //if ($ostatus_conversation)
- // complete_conversation($current_post, $ostatus_conversation);
-
$arr['id'] = $current_post;
$arr['parent'] = $parent_id;
$arr['allow_cid'] = $allow_cid;
$item_id = item_store($item, true);
if ($item_id) {
logger("Shouldn't happen. Code ".$reason." - uri ".$item["uri"], LOGGER_DEBUG);
- complete_conversation($item_id, $conversation_url, true);
+ complete_conversation($item_id, $conversation_url);
}
}
//echo $xml;
$conversation_url = ostatus_convert_href($conversation_url);
-/*
-To-Do:
- if (intval(get_config('system','ostatus_poll_interval')) == -2)
- return;
-
- if ($a->last_ostatus_conversation_url == $conversation_url)
- return;
-
- $a->last_ostatus_conversation_url = $conversation_url;
-
-*/
+ // If the thread shouldn't be completed then store the item and go away
+ if ((intval(get_config('system','ostatus_poll_interval')) == -2) AND (count($item) > 0)) {
+ $item_stored = item_store($item, true);
+ return($item_stored);
+ }
// Get the parent
$parents = q("SELECT `id`, `parent`, `uri`, `contact-id`, `type`, `verb`, `visible` FROM `item` WHERE `id` IN
logger("Conversation ".$conversation_url." couldn't be fetched. Item uri ".$item["uri"]." stored: ".$item_stored, LOGGER_DEBUG);
if ($item_stored)
- complete_conversation($item_id, $conversation_url, true);
+ complete_conversation($item_id, $conversation_url);
return($item_stored);
} else
logger('Stored new item '.$plink.' for parent '.$arr["parent-uri"].' under id '.$newitem, LOGGER_DEBUG);
// Add the conversation entry (but don't fetch the whole conversation)
- complete_conversation($newitem, $conversation_url, true);
+ complete_conversation($newitem, $conversation_url);
// If the newly created item is the top item then change the parent settings of the thread
// This shouldn't happen anymore. This is supposed to be absolote.
$parent = $new_parents[0];
}
}
-// Test
-/* if ((count($item) > 0) AND ($item_stored <= 0)) {
- $item_stored = item_store($item, true);
- logger("In the conversation ".$conversation_url." the item uri ".$item["uri"]." wasn't found: ".$item_stored, LOGGER_DEBUG);
-
- if ($item_stored)
- complete_conversation($item_id, $conversation_url, true);
- } */
return($item_stored);
}
-function complete_conversation($itemid, $conversation_url, $only_add_conversation = false) {
+function complete_conversation($itemid, $conversation_url) {
global $a;
$conversation_url = ostatus_convert_href($conversation_url);