From e9542a8d1715279faadf3a36fd2db8ce3f8c4589 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 21 Jun 2015 22:36:24 +0200 Subject: [PATCH] OStatus: Support for events and questions --- boot.php | 1 + include/ostatus.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/boot.php b/boot.php index 0aa7ab6341..193b34a60b 100644 --- a/boot.php +++ b/boot.php @@ -290,6 +290,7 @@ define ( 'ACTIVITY_OBJ_EVENT', NAMESPACE_ACTIVITY_SCHEMA . 'event' ); define ( 'ACTIVITY_OBJ_GROUP', NAMESPACE_ACTIVITY_SCHEMA . 'group' ); define ( 'ACTIVITY_OBJ_TAGTERM', NAMESPACE_DFRN . '/tagterm' ); define ( 'ACTIVITY_OBJ_PROFILE', NAMESPACE_DFRN . '/profile' ); +define ( 'ACTIVITY_OBJ_QUESTION', 'http://activityschema.org/object/question' ); /** * item weight for query ordering diff --git a/include/ostatus.php b/include/ostatus.php index ab5c00a6a0..463ebcd30a 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -191,10 +191,11 @@ 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) { + if (($item["object-type"] == ACTIVITY_OBJ_BOOKMARK) OR ($item["object-type"] == ACTIVITY_OBJ_EVENT)) { $item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue; $item["body"] = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue; - } + } elseif ($item["object-type"] == ACTIVITY_OBJ_QUESTION) + $item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue; $item["object"] = $xml; $item["verb"] = $xpath->query('activity:verb/text()', $entry)->item(0)->nodeValue; @@ -277,6 +278,9 @@ function ostatus_import($xml,$importer,&$contact, &$hub) { switch($rel) { case "alternate": $item["plink"] = $href; + if (($item["object-type"] == ACTIVITY_OBJ_QUESTION) OR + ($item["object-type"] == ACTIVITY_OBJ_EVENT)) + $item["body"] .= add_page_info($href); break; case "ostatus:conversation": $conversation = $href; -- 2.39.5