Code cleanup
This commit is contained in:
parent
6fbb03801c
commit
168906f9c9
3 changed files with 9 additions and 55 deletions
|
@ -9,7 +9,6 @@ require_once('include/tags.php');
|
|||
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');
|
||||
|
@ -481,7 +480,6 @@ function get_atom_elements($feed, $item, $contact = array()) {
|
|||
// 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) {
|
||||
|
@ -886,23 +884,6 @@ function get_atom_elements($feed, $item, $contact = array()) {
|
|||
}
|
||||
}
|
||||
|
||||
// // 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 = "";
|
||||
|
||||
|
@ -1139,15 +1120,6 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
|||
$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'])
|
||||
|
@ -1540,10 +1512,6 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
|
|||
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;
|
||||
|
|
|
@ -389,7 +389,7 @@ function ostatus_import($xml,$importer,&$contact, &$hub) {
|
|||
$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;
|
||||
|
|
|
@ -74,17 +74,11 @@ function ostatus_completion($conversation_url, $uid, $item = array()) {
|
|||
|
||||
$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
|
||||
|
@ -154,7 +148,7 @@ To-Do:
|
|||
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
|
||||
|
@ -401,7 +395,7 @@ To-Do:
|
|||
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.
|
||||
|
@ -413,19 +407,11 @@ To-Do:
|
|||
$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);
|
||||
|
|
Loading…
Reference in a new issue