aboutsummaryrefslogtreecommitdiffstats
path: root/include/feedutils.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-07-15 15:49:10 -0700
committerzotlabs <mike@macgirvin.com>2017-07-15 15:49:10 -0700
commite891199a23eb8839f0a6baa4b5695b058793917f (patch)
tree62659d7c4eb5dd8663d3a52dc52b294cd98389f1 /include/feedutils.php
parentb1d4e97699133020fcdb6e9a38f39a48afb1bfa5 (diff)
downloadvolse-hubzilla-e891199a23eb8839f0a6baa4b5695b058793917f.tar.gz
volse-hubzilla-e891199a23eb8839f0a6baa4b5695b058793917f.tar.bz2
volse-hubzilla-e891199a23eb8839f0a6baa4b5695b058793917f.zip
deal with mastodon privacy scopes - mark private and block commenting since we refuse to send private activities through the public OStatus connector.
Diffstat (limited to 'include/feedutils.php')
-rw-r--r--include/feedutils.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/include/feedutils.php b/include/feedutils.php
index b1fcce9d3..6ee53e2f6 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -408,8 +408,11 @@ function get_atom_elements($feed, $item, &$author) {
$ostatus_protocol = (($ostatus_conversation) ? true : false);
$mastodon = (($item->get_item_tags('http://mastodon.social/schema/1.0','scope')) ? true : false);
- if($mastodon)
+ if($mastodon) {
$ostatus_protocol = true;
+ if(($mastodon[0]['data']) && ($mastodon[0]['data'] !== 'public'))
+ $res['item_private'] = 1;
+ }
$apps = $item->get_item_tags(NAMESPACE_STATUSNET, 'notice_info');
if($apps && $apps[0]['attribs']['']['source']) {
@@ -1024,6 +1027,14 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
if(! $datarray['mid'])
continue;
+ // A Mastodon privacy tag has been found. We cannot send private comments
+ // through the OStatus protocol, so block commenting.
+
+ if(array_key_exists('item_private',$datarray) && intval($datarray['item_private'])) {
+ $datarray['public_policy'] = 'specific';
+ $datarray['comment_policy'] = 'none';
+ }
+
if($contact['xchan_network'] === 'rss') {
$datarray['public_policy'] = 'specific';
$datarray['comment_policy'] = 'none';
@@ -1220,6 +1231,14 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
if(! $datarray['mid'])
continue;
+ // A Mastodon privacy tag has been found. We cannot send private comments
+ // through the OStatus protocol, so block commenting.
+
+ if(array_key_exists('item_private',$datarray) && intval($datarray['item_private'])) {
+ $datarray['public_policy'] = 'specific';
+ $datarray['comment_policy'] = 'none';
+ }
+
if($contact['xchan_network'] === 'rss') {
$datarray['public_policy'] = 'specific';
$datarray['comment_policy'] = 'none';