]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/OStatusPlugin.php
Move some salmon processing to a superclass
[quix0rs-gnu-social.git] / plugins / OStatus / OStatusPlugin.php
index 4ebe4551ecbaf2991fd2079c851e87413f944b71..e1f3fd9d3713617ad245025832f8bfecd9e6c766 100644 (file)
@@ -63,10 +63,10 @@ class OStatusPlugin extends Plugin
 
         // Salmon endpoint
         $m->connect('main/salmon/user/:id',
-                    array('action' => 'salmon'),
+                    array('action' => 'usersalmon'),
                     array('id' => '[0-9]+'));
         $m->connect('main/salmon/group/:id',
-                    array('action' => 'salmongroup'),
+                    array('action' => 'groupsalmon'),
                     array('id' => '[0-9]+'));
         return true;
     }
@@ -253,17 +253,22 @@ class OStatusPlugin extends Plugin
      */
     function onEndUnsubscribe($user, $other)
     {
+        if ($user instanceof Profile) {
+            $profile = $user;
+        } else if ($user instanceof Profile) {
+            $profile = $user->getProfile();
+        }
         $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
         if ($oprofile) {
             // Notify the remote server of the unsub, if supported.
-            $oprofile->notify($user->getProfile(), ActivityVerb::UNFOLLOW, $oprofile);
+            $oprofile->notify($profile, ActivityVerb::UNFOLLOW, $oprofile);
 
             // Drop the PuSH subscription if there are no other subscribers.
             $sub = new Subscription();
             $sub->subscribed = $other->id;
             $sub->limit(1);
             if (!$sub->find(true)) {
-                common_log(LOG_INFO, "Unsubscribing from now-unused feed $oprofile->feeduri on hub $oprofile->huburi");
+                common_log(LOG_INFO, "Unsubscribing from now-unused feed $oprofile->feeduri");
                 $oprofile->unsubscribe();
             }
         }
@@ -326,6 +331,8 @@ class OStatusPlugin extends Plugin
         $oprofile = Ostatus_profile::staticGet('feeduri', $feedsub->uri);
         if ($oprofile) {
             $oprofile->processFeed($feed);
+        } else {
+            common_log(LOG_DEBUG, "No ostatus profile for incoming feed $feedsub->uri");
         }
     }
 }