]> git.mxchange.org Git - friendica.git/blobdiff - include/items.php
Better check for Diaspora accounts so you can connect them from the /suggest page.
[friendica.git] / include / items.php
index ed91fc7e4ed781393ab3f73eeae0b74a5de8867b..c1352cebbea41260dfbac3897be4f453e3e2f12f 100644 (file)
@@ -11,6 +11,7 @@ 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');
 
 function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) {
 
@@ -1343,6 +1344,22 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
                $current_post = $r[0]['id'];
                logger('item_store: created item ' . $current_post);
 
+               // Add every contact to the global contact table
+               // Contacts from the statusnet connector are also added since you could add them in OStatus as well.
+               if (!$arr['private'] AND in_array($arr["network"],
+                       array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_STATUSNET, "")))
+                       poco_check($arr["author-link"], $arr["author-name"], $arr["author-avatar"], "", $arr["received"], $arr['contact-id'], $arr['uid']);
+
+               // Set "success_update" to the date of the last time we heard from this contact
+               // This can be used to filter for inactive contacts and poco.
+               // Only do this for public postings to avoid privacy problems, since poco data is public.
+               // Don't set this value if it isn't from the owner (could be an author that we don't know)
+               if (!$arr['private'] AND (($arr["author-link"] === $arr["owner-link"]) OR ($arr["parent-uri"] === $arr["uri"])))
+                       q("UPDATE `contact` SET `success_update` = '%s' WHERE `id` = %d",
+                               dbesc($arr['received']),
+                               intval($arr['contact-id'])
+                       );
+
                // Only check for notifications on start posts
                if ($arr['parent-uri'] === $arr['uri']) {
                        add_thread($r[0]['id']);
@@ -2668,14 +2685,14 @@ function item_is_remote_self($contact, &$datarray) {
        $datarray2 = $datarray;
        logger('remote-self start - Contact '.$contact['url'].' - '.$contact['remote_self'].' Item '.print_r($datarray, true), LOGGER_DEBUG);
        if ($contact['remote_self'] == 2) {
-               $r = q("SELECT `id`,`url`,`name`,`photo`,`network` FROM `contact` WHERE `uid` = %d AND `self`",
+               $r = q("SELECT `id`,`url`,`name`,`thumb` FROM `contact` WHERE `uid` = %d AND `self`",
                        intval($contact['uid']));
                if (count($r)) {
                        $datarray['contact-id'] = $r[0]["id"];
 
                        $datarray['owner-name'] = $r[0]["name"];
                        $datarray['owner-link'] = $r[0]["url"];
-                       $datarray['owner-avatar'] = $r[0]["avatar"];
+                       $datarray['owner-avatar'] = $r[0]["thumb"];
 
                        $datarray['author-name']   = $datarray['owner-name'];
                        $datarray['author-link']   = $datarray['owner-link'];