]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/OStatusPlugin.php
Form for posting a group message on group inbox
[quix0rs-gnu-social.git] / plugins / OStatus / OStatusPlugin.php
index 7d62eaba6d1e27eb167a6b40ccc351e8e8060eb1..59c18746f0d6892398d34d34d1798892307db64f 100644 (file)
@@ -145,12 +145,10 @@ class OStatusPlugin extends Plugin
             $user = $feed->getUser();
             $id   = $user->id;
             $profile = $user->getProfile();
-            $feed->setActivitySubject($profile->asActivityNoun('subject'));
         } else if ($feed instanceof AtomGroupNoticeFeed) {
             $salmonAction = 'groupsalmon';
             $group = $feed->getGroup();
             $id = $group->id;
-            $feed->setActivitySubject($group->asActivitySubject());
         } else {
             return true;
         }
@@ -994,23 +992,41 @@ 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.
+
+        $user = User::staticGet('uri', $uri);
+        
+        if (!empty($user)) {
+            $profile = $user->getProfile();
+            return false;
+        }
 
-        // XXX: do discovery here instead (OStatus_profile::ensureProfileURI($uri))
+        // Now, check remotely
 
-        $oprofile = Ostatus_profile::staticGet('uri', $uri);
+        $oprofile = Ostatus_profile::ensureProfileURI($uri);
 
-        if (!empty($oprofile) && !$oprofile->isGroup()) {
+        if (!empty($oprofile)) {
             $profile = $oprofile->localProfile();
             return false;
         }
 
+        // Still not a hit, so give up.
+
         return true;
     }
 
     function onEndXrdActionLinks(&$xrd, $user)
     {
-        // Salmon
+       $xrd->links[] = array('rel' => Discovery::UPDATESFROM,
+                             'href' => common_local_url('ApiTimelineUser',
+                                                        array('id' => $user->id,
+                                                              'format' => 'atom')),
+                             'type' => 'application/atom+xml');
+       
+                   // Salmon
         $salmon_url = common_local_url('usersalmon',
                                        array('id' => $user->id));