]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Handle profile-from-uri hook to return ostatus profile if there's a match
authorEvan Prodromou <evan@status.net>
Wed, 1 Sep 2010 20:16:38 +0000 (16:16 -0400)
committerEvan Prodromou <evan@status.net>
Wed, 1 Sep 2010 20:16:38 +0000 (16:16 -0400)
plugins/OStatus/OStatusPlugin.php

index 6fef20d6f59172a085d345445ced56adce66a8ca..fff692c82bdaaf05b58e9d2adaa9149bdeeccecd 100644 (file)
@@ -492,7 +492,7 @@ class OStatusPlugin extends Plugin
      * Tell the FeedSub infrastructure whether we have any active OStatus
      * usage for the feed; if not it'll be able to garbage-collect the
      * feed subscription.
-     * 
+     *
      * @param FeedSub $feedsub
      * @param integer $count in/out
      * @return mixed hook return code
@@ -995,4 +995,18 @@ class OStatusPlugin extends Plugin
         $feed = $oprofile->feeduri;
         return false;
     }
+
+    function onStartGetProfileFromURI($uri, &$profile) {
+
+        // XXX: do discovery here instead (OStatus_profile::ensureProfileURI($uri))
+
+        $oprofile = Ostatus_profile::staticGet('uri', $uri);
+
+        if (!empty($oprofile) && !$oprofile->isGroup()) {
+            $profile = $oprofile->localProfile();
+            return false;
+        }
+
+        return true;
+    }
 }