]> git.mxchange.org Git - friendica.git/commitdiff
OStatus: Support for "Favorite" (like)
authorMichael Vogel <icarus@dabo.de>
Wed, 15 Jul 2015 06:16:41 +0000 (08:16 +0200)
committerMichael Vogel <icarus@dabo.de>
Wed, 15 Jul 2015 06:16:41 +0000 (08:16 +0200)
include/ostatus.php

index 53887d535b1b5d3f8bcfdc55b176b19c8a2878d8..181b9e2974a3dd19703668aa8a061ba245b0bf7b 100644 (file)
@@ -239,11 +239,13 @@ function ostatus_import($xml,$importer,&$contact, &$hub) {
                // Delete a message
                if ($item["verb"] == "qvitter-delete-notice") {
                        // ignore "Delete" messages (by now)
+                       logger("Ignore delete message ".print_r($item, true));
                        continue;
                }
 
                if ($item["verb"] == ACTIVITY_JOIN) {
                        // ignore "Join" messages
+                       logger("Ignore join message ".print_r($item, true));
                        continue;
                }
 
@@ -258,10 +260,25 @@ function ostatus_import($xml,$importer,&$contact, &$hub) {
                }
 
                if ($item["verb"] == ACTIVITY_FAVORITE) {
-                       // ignore "Favorite" messages
+                       $orig_uri = $xpath->query("activity:object/atom:id", $entry)->item(0)->nodeValue;
+                       logger("Favorite ".$orig_uri." ".print_r($item, true));
+
+                       $item["verb"] = ACTIVITY_LIKE;
+                       $item["parent-uri"] = $orig_uri;
+                       $item["gravity"] = GRAVITY_LIKE;
+               }
+
+               if ($item["verb"] == NAMESPACE_OSTATUS."/unfavorite") {
+                       // Ignore "Unfavorite" message
+                       logger("Ignore unfavorite message ".print_r($item, true));
                        continue;
                }
 
+               // http://activitystrea.ms/schema/1.0/rsvp-yes
+               // http://activitystrea.ms/schema/1.0/share
+               if (!in_array($item["verb"], array(ACTIVITY_POST, ACTIVITY_LIKE)))
+                       logger("Unhandled verb ".$item["verb"]." ".print_r($item, true));
+
                $item["created"] = $xpath->query('atom:published/text()', $entry)->item(0)->nodeValue;
                $item["edited"] = $xpath->query('atom:updated/text()', $entry)->item(0)->nodeValue;
                $conversation = $xpath->query('ostatus:conversation/text()', $entry)->item(0)->nodeValue;