From da9bbc92d378e3b000bdf72f637516fd691618e6 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 21 Jun 2015 22:02:44 +0200 Subject: [PATCH] OStatus: Support for bookmarks --- include/ostatus.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/include/ostatus.php b/include/ostatus.php index d1a1f4f988..ab5c00a6a0 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -190,6 +190,12 @@ function ostatus_import($xml,$importer,&$contact, &$hub) { $item["body"] = add_page_info_to_body(html2bbcode($xpath->query('atom:content/text()', $entry)->item(0)->nodeValue)); $item["object-type"] = $xpath->query('activity:object-type/text()', $entry)->item(0)->nodeValue; + + if ($item["object-type"] == ACTIVITY_OBJ_BOOKMARK) { + $item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue; + $item["body"] = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue; + } + $item["object"] = $xml; $item["verb"] = $xpath->query('activity:verb/text()', $entry)->item(0)->nodeValue; @@ -283,11 +289,14 @@ function ostatus_import($xml,$importer,&$contact, &$hub) { $item["attach"] .= '[attach]href="'.$href.'" length="'.$length.'" type="'.$type.'" title="'.$title.'"[/attach]'; break; case "related": - if (!isset($item["parent-uri"])) - $item["parent-uri"] = $href; + if ($item["object-type"] != ACTIVITY_OBJ_BOOKMARK) { + if (!isset($item["parent-uri"])) + $item["parent-uri"] = $href; - if ($related == "") - $related = $href; + if ($related == "") + $related = $href; + } else + $item["body"] .= add_page_info($href); break; case "self": $self = $href; @@ -812,8 +821,8 @@ function ostatus_completion($conversation_url, $uid, $item = array()) { // Copy fields from given item array if (isset($item["uri"]) AND (($item["uri"] == $arr["uri"]) OR ($item["uri"] == $single_conv->id))) { $copy_fields = array("owner-name", "owner-link", "owner-avatar", "author-name", "author-link", "author-avatar", - "gravity", "body", "object-type", "verb", "created", "edited", "coord", "tag", - "attach", "app", "type", "location", "contact-id", "uri"); + "gravity", "body", "object-type", "object", "verb", "created", "edited", "coord", "tag", + "title", "attach", "app", "type", "location", "contact-id", "uri"); foreach ($copy_fields AS $field) if (isset($item[$field])) $arr[$field] = $item[$field];