]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
FeedSub gets a plugin event handler for sub/unsub
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 9 Mar 2014 12:27:28 +0000 (13:27 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 9 Mar 2014 12:27:28 +0000 (13:27 +0100)
plugins/OStatus/classes/FeedSub.php

index dc0f4ea1e2d617faeb7b06d48867c8f5311d00b0..cf258444e88fa0fa7f21201f9d4d9039cef9b132 100644 (file)
@@ -169,6 +169,12 @@ class FeedSub extends Managed_DataObject
         if ($this->sub_state && $this->sub_state != 'inactive') {
             common_log(LOG_WARNING, "Attempting to (re)start PuSH subscription to {$this->uri} in unexpected state {$this->sub_state}");
         }
+
+        if (!Event::handle('FeedSubscribe', array($this))) {
+            // A plugin handled it
+            return true;
+        }
+
         if (empty($this->huburi)) {
             if (common_config('feedsub', 'fallback_hub')) {
                 // No native hub on this feed?
@@ -200,6 +206,12 @@ class FeedSub extends Managed_DataObject
         if ($this->sub_state != 'active') {
             common_log(LOG_WARNING, "Attempting to (re)end PuSH subscription to {$this->uri} in unexpected state {$this->sub_state}");
         }
+
+        if (!Event::handle('FeedUnsubscribe', array($this))) {
+            // A plugin handled it
+            return true;
+        }
+
         if (empty($this->huburi)) {
             if (common_config('feedsub', 'fallback_hub')) {
                 // No native hub on this feed?