]> git.mxchange.org Git - friendica.git/commitdiff
Feed should work now as well
authorMichael Vogel <icarus@dabo.de>
Thu, 4 Feb 2016 22:52:06 +0000 (23:52 +0100)
committerMichael Vogel <icarus@dabo.de>
Thu, 4 Feb 2016 22:52:06 +0000 (23:52 +0100)
include/import-dfrn.php
include/items.php

index edbbde98a063196ea032f6d81d0d40fbfdd6036b..72d507bbf119b245ad46c395361620f75d36fc6a 100644 (file)
@@ -961,8 +961,10 @@ class dfrn2 {
                                $item["owner-avatar"] = $importer["thumb"];
                        }
 
-                       if(($importer["rel"] == CONTACT_IS_FOLLOWER) && (!tgroup_check($importer["importer_uid"], $item)))
+                       if(($importer["rel"] == CONTACT_IS_FOLLOWER) && (!tgroup_check($importer["importer_uid"], $item))) {
+                               logger("Contact ".$importer["id"]." is only follower and tgroup check was negative.", LOGGER_DEBUG);
                                return;
+                       }
 
                        // This is my contact on another system, but it's really me.
                        // Turn this into a wall post.
@@ -1183,9 +1185,24 @@ class dfrn2 {
                foreach ($deletions AS $deletion)
                        self::process_deletion($header, $xpath, $deletion, $importer);
 
-               $entries = $xpath->query("/atom:feed/atom:entry");
-               foreach ($entries AS $entry)
-                       self::process_entry($header, $xpath, $entry, $importer);
+               if (!$sort_by_date) {
+                       $entries = $xpath->query("/atom:feed/atom:entry");
+                       foreach ($entries AS $entry)
+                               self::process_entry($header, $xpath, $entry, $importer);
+               } else {
+                       $newentries = array();
+                       $entries = $xpath->query("/atom:feed/atom:entry");
+                       foreach ($entries AS $entry) {
+                               $created = $xpath->query("atom:published/text()", $entry)->item(0)->nodeValue;
+                               $newentries[strtotime($created)] = $entry;
+                       }
+
+                       // Now sort after the publishing date
+                       ksort($newentries);
+
+                       foreach ($newentries AS $entry)
+                               self::process_entry($header, $xpath, $entry, $importer);
+               }
        }
 }
 ?>
index 0ec645cc7a5be76af794e87a37f6939c332739dd..52a1071f2d089c19c2d3dc8aa816b93264c5e860 100644 (file)
@@ -1695,11 +1695,9 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
                }
                return;
        }
-       // dfrn-test
-/*
+
        if ($contact['network'] === NETWORK_DFRN) {
                logger("Consume DFRN messages", LOGGER_DEBUG);
-               logger("dfrn-test");
 
                $r = q("SELECT  `contact`.*, `contact`.`uid` AS `importer_uid`,
                                         `contact`.`pubkey` AS `cpubkey`,
@@ -1711,14 +1709,15 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
                         FROM `contact`
                         LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
                         WHERE `contact`.`id` = %d AND `user`.`uid` = %d",
-                       dbesc($contact["id"], $importer["uid"]);
+                       dbesc($contact["id"]), dbesc($importer["uid"])
                );
                if ($r) {
+                       logger("Now import the DFRN feed");
                        dfrn2::import($xml,$r[0], true);
                        return;
                }
        }
-*/
+
        // Test - remove before flight
        //if ($pass < 2) {
        //      $tempfile = tempnam(get_temppath(), "dfrn-consume-");