From a1b0d5fa7e9edd9d8fed0bfaaa36a3247b3e2269 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 9 Mar 2014 13:27:28 +0100 Subject: [PATCH] FeedSub gets a plugin event handler for sub/unsub --- plugins/OStatus/classes/FeedSub.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php index dc0f4ea1e2..cf258444e8 100644 --- a/plugins/OStatus/classes/FeedSub.php +++ b/plugins/OStatus/classes/FeedSub.php @@ -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?