From fae3592c7907eeee41904266124ff97046f3dcb9 Mon Sep 17 00:00:00 2001
From: Michael Vogel <icarus@dabo.de>
Date: Sun, 31 May 2015 13:28:16 +0200
Subject: [PATCH] Bugfix: You wasn't able to add an OStatus contact when you
 are following the same contact via Statusnet connector.

---
 mod/follow.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mod/follow.php b/mod/follow.php
index b9401ee825..95f95d024f 100755
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -14,8 +14,11 @@ function follow_content(&$a) {
 	$uid = local_user();
 	$url = notags(trim($_REQUEST['url']));
 
-	$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND (`nurl` = '%s' OR `alias` = '%s' OR `alias` = '%s') LIMIT 1",
-		intval(local_user()), dbesc(normalise_link($url)), dbesc(normalise_link($url)), dbesc($url));
+	$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND
+		(`nurl` = '%s' OR `alias` = '%s' OR `alias` = '%s') AND
+		`network` != '%s' LIMIT 1",
+		intval(local_user()), dbesc(normalise_link($url)),
+		dbesc(normalise_link($url)), dbesc($url), dbesc(NETWORK_STATUSNET));
 
 	if ($r) {
 		notice(t('You already added this contact.').EOL);