]> git.mxchange.org Git - friendica-addons.git/commitdiff
appnet, statusnet: Posts from unknown contacts weren't posted
authorMichael Vogel <icarus@dabo.de>
Fri, 27 Jun 2014 05:59:00 +0000 (07:59 +0200)
committerMichael Vogel <icarus@dabo.de>
Fri, 27 Jun 2014 05:59:00 +0000 (07:59 +0200)
appnet/appnet.php
statusnet/statusnet.php

index 4bf72da536dc763a531cb0b124dc9d19ecdef220..62b66c320a65341ecbae2c86e2295ccdbe9c22a0 100644 (file)
@@ -825,13 +825,15 @@ function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $th
        if (isset($post["reply_to"]) AND ($post["reply_to"] != "")) {
                $postarray['thr-parent'] = "adn::".$post["reply_to"];
 
-               // Complete the thread if the parent doesn't exists
+               // Complete the thread (if the parent doesn't exists)
                if ($threadcompletion) {
-                       $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
-                               dbesc($postarray['thr-parent']),
-                               intval($uid)
-                               );
-                       if (!count($r)) {
+                       //$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+                       //      dbesc($postarray['thr-parent']),
+                       //      intval($uid)
+                       //      );
+                       //if (!count($r)) {
+                               logger("appnet_createpost: completing thread ".$post["thread_id"]." for user ".$uid, LOGGER_DEBUG);
+
                                require_once("addon/appnet/AppDotNet.php");
 
                                $token = get_pconfig($uid,'appnet','token');
@@ -850,11 +852,15 @@ function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $th
                                        logger("appnet_createpost: Error fetching thread for user ".$uid." ".appnet_error($e->getMessage()));
                                }
                                $thread = array_reverse($thread);
+
+                               logger("appnet_createpost: fetched ".count($thread)." items for thread ".$post["thread_id"]." for user ".$uid, LOGGER_DEBUG);
+
                                foreach ($thread AS $tpost) {
                                        $threadpost = appnet_createpost($a, $uid, $tpost, $me, $user, $ownid, false, false);
                                        $item = item_store($threadpost);
+                                       logger("appnet_createpost: stored post ".$post["id"]." thread ".$post["thread_id"]." in item ".$item, LOGGER_DEBUG);
                                }
-                       }
+                       //}
                }
                // Don't create accounts of people who just comment something
                $createuser = false;
@@ -1042,10 +1048,10 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
                intval($uid), dbesc("adn::".$contact["id"]));
 
        if(!count($r) AND !$create_user)
-               return($me);
+               return($me["id"]);
 
        if ($contact["canonical_url"] == "")
-               return($me);
+               return($me["id"]);
 
        if (count($r) AND ($r[0]["readonly"] OR $r[0]["blocked"])) {
                logger("appnet_fetchcontact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
index 2f3f84d20eeaacd035baeb6057925ac47cae800f..38381ef31f1eb1fc470713b27a0b4a2a6bbfedf5 100644 (file)
@@ -1394,7 +1394,7 @@ function statusnet_complete_conversation($a, $uid, $self, $create_user, $nick, $
                $posts = array_reverse($items);
 
                foreach($posts AS $post) {
-                       $postarray = statusnet_createpost($a, $uid, $post, $self, $create_user, true);
+                       $postarray = statusnet_createpost($a, $uid, $post, $self, false, false);
 
                        if (trim($postarray['body']) == "")
                                continue;