]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/actions/ostatusinit.php
Implemented WebFinger and replaced our XRD with PEAR XML_XRD
[quix0rs-gnu-social.git] / plugins / OStatus / actions / ostatusinit.php
index f559eec3e321f7542f957caadd6941c1b2269c6b..d8b3fdec51832d36f7fdac3f28b9b67c567ef1e1 100644 (file)
@@ -175,20 +175,14 @@ class OStatusInitAction extends Action
         $target_profile = $this->targetProfile();
 
         $disco = new Discovery;
-        $result = $disco->lookup($acct);
-        if (!$result) {
-            // TRANS: Client error.
-            $this->clientError(_m('Could not look up OStatus account profile.'));
-        }
-
-        foreach ($result->links as $link) {
-            if ($link['rel'] == 'http://ostatus.org/schema/1.0/subscribe') {
-                // We found a URL - let's redirect!
-                $url = Discovery::applyTemplate($link['template'], $target_profile);
-                common_log(LOG_INFO, "Sending remote subscriber $acct to $url");
-                common_redirect($url, 303);
-            }
-
+        $xrd = $disco->lookup($acct);
+
+        $link = $xrd->get('http://ostatus.org/schema/1.0/subscribe');
+        if (!is_null($link)) {
+            // We found a URL - let's redirect!
+            $url = Discovery::applyTemplate($link['template'], $target_profile);
+            common_log(LOG_INFO, "Sending remote subscriber $acct to $url");
+            common_redirect($url, 303);
         }
         // TRANS: Client error.
         $this->clientError(_m('Could not confirm remote profile address.'));