]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/OStatusPlugin.php
OStatus: sub/unsub notifications working again. Fixed up autodetection of feed info...
[quix0rs-gnu-social.git] / plugins / OStatus / OStatusPlugin.php
index 4ebe4551ecbaf2991fd2079c851e87413f944b71..1b58d3c35620dabc16a211a729d2f8bd7029b464 100644 (file)
@@ -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");
         }
     }
 }