OStatus: Support for bookmarks

This commit is contained in:
Michael Vogel 2015-06-21 22:02:44 +02:00
parent 2afc9c31f9
commit da9bbc92d3
1 changed files with 15 additions and 6 deletions

View File

@ -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["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; $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["object"] = $xml;
$item["verb"] = $xpath->query('activity:verb/text()', $entry)->item(0)->nodeValue; $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]'; $item["attach"] .= '[attach]href="'.$href.'" length="'.$length.'" type="'.$type.'" title="'.$title.'"[/attach]';
break; break;
case "related": case "related":
if (!isset($item["parent-uri"])) if ($item["object-type"] != ACTIVITY_OBJ_BOOKMARK) {
$item["parent-uri"] = $href; if (!isset($item["parent-uri"]))
$item["parent-uri"] = $href;
if ($related == "") if ($related == "")
$related = $href; $related = $href;
} else
$item["body"] .= add_page_info($href);
break; break;
case "self": case "self":
$self = $href; $self = $href;
@ -812,8 +821,8 @@ function ostatus_completion($conversation_url, $uid, $item = array()) {
// Copy fields from given item array // Copy fields from given item array
if (isset($item["uri"]) AND (($item["uri"] == $arr["uri"]) OR ($item["uri"] == $single_conv->id))) { 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", $copy_fields = array("owner-name", "owner-link", "owner-avatar", "author-name", "author-link", "author-avatar",
"gravity", "body", "object-type", "verb", "created", "edited", "coord", "tag", "gravity", "body", "object-type", "object", "verb", "created", "edited", "coord", "tag",
"attach", "app", "type", "location", "contact-id", "uri"); "title", "attach", "app", "type", "location", "contact-id", "uri");
foreach ($copy_fields AS $field) foreach ($copy_fields AS $field)
if (isset($item[$field])) if (isset($item[$field]))
$arr[$field] = $item[$field]; $arr[$field] = $item[$field];