From 40d3e7982ccae52996ffe88e6cb7e4acfb51f369 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Thu, 10 May 2018 11:04:18 +0000
Subject: [PATCH] Adopt the relay definition according to the suggestions from
 @jaywink

---
 mod/_well_known.php              |  4 ++--
 src/Protocol/PortableContact.php | 12 ++++++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/mod/_well_known.php b/mod/_well_known.php
index 782dc7a1b1..407fc756a9 100644
--- a/mod/_well_known.php
+++ b/mod/_well_known.php
@@ -73,8 +73,8 @@ function wk_social_relay()
 		'subscribe' => $subscribe,
 		'scope' => $scope,
 		'tags' => $taglist,
-		'protocols' => ['diaspora' => System::baseUrl() . '/receive/public',
-			'dfrn' => System::baseUrl() . '/dfrn_notify']
+		'protocols' => ['diaspora' => ['receive' => System::baseUrl() . '/receive/public'],
+			'dfrn' => ['receive' => System::baseUrl() . '/dfrn_notify']]
 	];
 
 	header('Content-type: application/json; charset=utf-8');
diff --git a/src/Protocol/PortableContact.php b/src/Protocol/PortableContact.php
index 672956ffb9..d737f4d5af 100644
--- a/src/Protocol/PortableContact.php
+++ b/src/Protocol/PortableContact.php
@@ -1436,11 +1436,19 @@ class PortableContact
 		if (isset($data->protocols)) {
 			if (isset($data->protocols->diaspora)) {
 				$fields['network'] = NETWORK_DIASPORA;
-				$fields['batch'] = $data->protocols->diaspora;
+				if (isset($data->protocols->diaspora->receive)) {
+					$fields['batch'] = $data->protocols->diaspora->receive;
+				} elseif (is_string($data->protocols->diaspora)) {
+					$fields['batch'] = $data->protocols->diaspora;
+				}
 			}
 			if (isset($data->protocols->dfrn)) {
 				$fields['network'] = NETWORK_DFRN;
-				$fields['batch'] = $data->protocols->dfrn;
+				if (isset($data->protocols->dfrn->receive)) {
+					$fields['batch'] = $data->protocols->dfrn->receive;
+				} elseif (is_string($data->protocols->dfrn)) {
+					$fields['batch'] = $data->protocols->dfrn;
+				}
 			}
 		}
 		Diaspora::setRelayContact($server_url, $fields);