]> git.mxchange.org Git - friendica.git/commitdiff
Code cleanup
authorMichael Vogel <icarus@dabo.de>
Sat, 20 Jun 2015 07:15:19 +0000 (09:15 +0200)
committerMichael Vogel <icarus@dabo.de>
Sat, 20 Jun 2015 07:15:19 +0000 (09:15 +0200)
include/items.php
include/ostatus.php
include/ostatus_conversation.php

index b085ac8cfaf2c8289fb127619ca2745dd41651a5..7a30130bbcb019fe760150eb1d188869c2f6e8de 100644 (file)
@@ -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;
index 996cbea1fd64a97e0c79532bcac54de70a497a17..bf88efab9a159e9f4868108444d7571f4d700955 100644 (file)
@@ -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;
index fd90ba3dd1d4d5af21ee977386920bb8baf8ecc3..03678cbb4a6aa730554da488d55938df662587ac 100644 (file)
@@ -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);