]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/OStatusPlugin.php
Widget automatically delegates unimplemented methods to attribute
[quix0rs-gnu-social.git] / plugins / OStatus / OStatusPlugin.php
index f846a2fc8b94c46b6053afb39cb8ca60d36ff85b..738481149c89ee6636408780011ab14aecf49c1a 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;
         }
@@ -230,7 +228,7 @@ class OStatusPlugin extends Plugin
         return false;
     }
 
-    function onStartGroupSubscribe($output, $group)
+    function onStartGroupSubscribe($widget, $group)
     {
         $cur = common_current_user();
 
@@ -238,7 +236,7 @@ class OStatusPlugin extends Plugin
             // Add an OStatus subscribe
             $url = common_local_url('ostatusinit',
                                     array('group' => $group->nickname));
-            $output->element('a', array('href' => $url,
+            $widget->out->element('a', array('href' => $url,
                                         'class' => 'entity_remote_subscribe'),
                                 // TRANS: Link description for link to join a remote group.
                                 _m('Join'));
@@ -421,12 +419,12 @@ class OStatusPlugin extends Plugin
     }
 
     function onEndShowStatusNetStyles($action) {
-        $action->cssLink('plugins/OStatus/theme/base/css/ostatus.css');
+        $action->cssLink($this->path('theme/base/css/ostatus.css'));
         return true;
     }
 
     function onEndShowStatusNetScripts($action) {
-        $action->script('plugins/OStatus/js/ostatus.js');
+        $action->script($this->path('js/ostatus.js'));
         return true;
     }
 
@@ -994,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.
+
+        $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;
     }