From d0dfe2aa64439eb1fe74be2cfb102303307eca67 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sat, 7 Apr 2018 10:02:43 +0000
Subject: [PATCH] Fix: Empty answers in DFRN can be okay

---
 src/Protocol/DFRN.php | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php
index 734fbde62..d1a4f0c4b 100644
--- a/src/Protocol/DFRN.php
+++ b/src/Protocol/DFRN.php
@@ -1361,10 +1361,15 @@ class DFRN
 
 		$res = XML::parseString($xml);
 
-		if (empty($res->status)) {
+		if (!isset($res->status)) {
 			return -11;
 		}
 
+		// Possibly old servers had returned an empty value when everything was okay
+		if (empty($res->status)) {
+			$res->status = 200;
+		}
+
 		if (!empty($res->message)) {
 			logger('Delivery returned status '.$res->status.' - '.$res->message, LOGGER_DEBUG);
 		}
@@ -1405,7 +1410,7 @@ class DFRN
 		$fcontact = Diaspora::personByHandle($contact['addr']);
 		if (empty($fcontact)) {
 			logger('Unable to find contact details for ' . $contact['id'] . ' - ' . $contact['addr']);
-			return -21;
+			return -22;
 		}
 
 		$envelope = Diaspora::buildMessage($atom, $owner, $contact, $owner['uprvkey'], $fcontact['pubkey'], $public_batch);
@@ -1435,7 +1440,7 @@ class DFRN
 		$res = XML::parseString($xml);
 
 		if (empty($res->status)) {
-			return -11;
+			return -23;
 		}
 
 		if (!empty($res->message)) {