]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/APContact.php
New option to disable the fetching of parents
[friendica.git] / src / Model / APContact.php
index ba2e3c9734fdff020a3dcc6e35958cb0f4f44ce1..38ec423e89cf2794b9389ca2e7b980aa6743da15 100644 (file)
@@ -38,6 +38,7 @@ use Friendica\Util\DateTimeFormat;
 use Friendica\Util\HTTPSignature;
 use Friendica\Util\JsonLD;
 use Friendica\Util\Network;
+use GuzzleHttp\Psr7\Uri;
 
 class APContact
 {
@@ -310,6 +311,8 @@ class APContact
 
                $apcontact['manually-approve'] = (int)JsonLD::fetchElement($compacted, 'as:manuallyApprovesFollowers');
 
+               $apcontact['suspended'] = (int)JsonLD::fetchElement($compacted, 'toot:suspended');
+
                if (!empty($compacted['as:generator'])) {
                        $apcontact['baseurl'] = JsonLD::fetchElement($compacted['as:generator'], 'as:url', '@id');
                        $apcontact['generator'] = JsonLD::fetchElement($compacted['as:generator'], 'as:name', '@value');
@@ -380,11 +383,11 @@ class APContact
                if (strlen($apcontact['photo']) > 255) {
                        $parts = parse_url($apcontact['photo']);
                        unset($parts['fragment']);
-                       $apcontact['photo'] = Network::unparseURL($parts);
+                       $apcontact['photo'] = (string)Uri::fromParts($parts);
 
                        if (strlen($apcontact['photo']) > 255) {
                                unset($parts['query']);
-                               $apcontact['photo'] = Network::unparseURL($parts);
+                               $apcontact['photo'] = (string)Uri::fromParts($parts);
                        }
 
                        if (strlen($apcontact['photo']) > 255) {
@@ -539,6 +542,13 @@ class APContact
                HTTPSignature::setInboxStatus($url, true, $shared);
        }
 
+       /**
+        * Check if the apcontact is a relay account
+        *
+        * @param array $apcontact
+        *
+        * @return bool 
+        */
        public static function isRelay(array $apcontact): bool
        {
                if ($apcontact['nick'] != 'relay') {
@@ -549,7 +559,7 @@ class APContact
                        return true;
                }
 
-               if (in_array($apcontact['type'], ['Group', 'Service']) && ($apcontact['nick'] == 'relay') && is_null($apcontact['outbox'])) {
+               if (in_array($apcontact['type'], ['Group', 'Service']) && is_null($apcontact['outbox'])) {
                        return true;
                }