From a2aa87fbffe8b73d32463d1763e024da7ccdcd0b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 17 Jan 2011 15:45:03 -0500 Subject: [PATCH] OStatusPlugin does discovery in Profile::fromURI() --- plugins/OStatus/OStatusPlugin.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 86bd15e0b7..59c18746f0 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -992,17 +992,29 @@ class OStatusPlugin extends Plugin return false; } - function onStartGetProfileFromURI($uri, &$profile) { + function onStartGetProfileFromURI($uri, &$profile) + { + // Don't want to do Web-based discovery on our own server, + // so we check locally first. - // XXX: do discovery here instead (OStatus_profile::ensureProfileURI($uri)) + $user = User::staticGet('uri', $uri); + + if (!empty($user)) { + $profile = $user->getProfile(); + return false; + } - $oprofile = Ostatus_profile::staticGet('uri', $uri); + // Now, check remotely - if (!empty($oprofile) && !$oprofile->isGroup()) { + $oprofile = Ostatus_profile::ensureProfileURI($uri); + + if (!empty($oprofile)) { $profile = $oprofile->localProfile(); return false; } + // Still not a hit, so give up. + return true; } -- 2.39.5