From 51dca9b034b8b34fc24a0aa161b3b26c8766a49f Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 21 Aug 2017 20:21:04 +0000 Subject: [PATCH] Compatibility with pleroma added --- include/feed.php | 8 ++++++++ include/ostatus.php | 2 +- src/Network/Probe.php | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/feed.php b/include/feed.php index cfef6d4ad0..1545ff34ce 100644 --- a/include/feed.php +++ b/include/feed.php @@ -108,6 +108,14 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) { if ($value != "") { $author["author-about"] = $value; } + $avatar = $xpath->evaluate("atom:author/atom:link[@rel='avatar']")->item(0)->attributes; + if (is_object($avatar)) { + foreach ($avatar AS $attributes) { + if ($attributes->name == "href") { + $author["author-avatar"] = $attributes->textContent; + } + } + } } $author["edited"] = $author["created"] = $xpath->query('/atom:feed/atom:updated/text()')->item(0)->nodeValue; diff --git a/include/ostatus.php b/include/ostatus.php index 6bec3987bb..3e27bc5d57 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -101,7 +101,7 @@ class ostatus { $width = $attributes->textContent; } } - if (($width > 0) && ($href != "")) { + if ($href != "") { $avatarlist[$width] = $href; } } diff --git a/src/Network/Probe.php b/src/Network/Probe.php index 5a70247afc..17b44eadb3 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -1201,6 +1201,7 @@ class Probe { if (!$feed_data) { return false; } + if ($feed_data["header"]["author-name"] != "") { $data["name"] = $feed_data["header"]["author-name"]; } @@ -1224,6 +1225,12 @@ class Probe { if ($feed_data["header"]["author-link"] != "") { $data["url"] = $feed_data["header"]["author-link"]; } + + if (($data['poll'] == $data['url']) && ($data["alias"] != '')) { + $data['url'] = $data["alias"]; + $data["alias"] = ''; + } + /// @todo Fetch location and "about" from the feed as well return $data; } -- 2.39.5