From 2d589a7d0cf9275224d53c1067cce35ad6ea7c43 Mon Sep 17 00:00:00 2001
From: Michael Vogel <icarus@dabo.de>
Date: Mon, 24 Aug 2015 14:23:30 +0200
Subject: [PATCH] Movew the alternate OStatus profile link into the regular one

---
 include/socgraph.php | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/socgraph.php b/include/socgraph.php
index c6c4f5ea8e..1477c2f207 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -453,7 +453,7 @@ function poco_last_updated($profile, $force = false) {
 			$noscraperet = z_fetch_url($server[0]["noscrape"]."/".$gcontacts[0]["nick"]);
 
 			 if ($noscraperet["success"] AND ($noscraperet["body"] != "")) {
-;
+
 				$noscrape = json_decode($noscraperet["body"], true);
 
 				if (($noscrape["fn"] != "") AND ($noscrape["fn"] != $gcontacts[0]["name"]))
@@ -529,6 +529,22 @@ function poco_last_updated($profile, $force = false) {
 
 	$data = probe_url($profile);
 
+	// Is the profile link the alternate OStatus link notation? (http://domain.tld/user/4711)
+	// Then check the other link and mark this one as a failure
+	if (($data["network"] == NETWORK_OSTATUS) AND
+		(normalise_link($profile) == normalise_link($data["alias"])) AND
+		(normalise_link($profile) != normalise_link($data["url"]))) {
+		poco_check($data["url"], $data["name"], $data["network"], $data["photo"], $gcontacts[0]["about"], $gcontacts[0]["location"],
+				$gcontacts[0]["gender"], $gcontacts[0]["keywords"], $data["addr"], $gcontacts[0]["updated"], $gcontacts[0]["generation"]);
+
+		q("UPDATE `gcontact` SET `last_failure` = '%s' WHERE `nurl` = '%s'",
+			dbesc(datetime_convert()), dbesc(normalise_link($profile)));
+
+		 poco_last_updated($data["url"], $force);
+
+		return false;
+	}
+
 	if (($data["poll"] == "") OR ($data["network"] == NETWORK_FEED)) {
 		q("UPDATE `gcontact` SET `last_failure` = '%s' WHERE `nurl` = '%s'",
 			dbesc(datetime_convert()), dbesc(normalise_link($profile)));