From ba9abb3c577b955012a66bcd3320639865778440 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Fri, 16 Jan 2015 01:10:55 +0100 Subject: [PATCH] Add nohub config setting to allowed non-PuSH feeds --- plugins/OStatus/classes/FeedSub.php | 10 +++++----- plugins/OStatus/classes/Ostatus_profile.php | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php index 25a826a552..57c056f5fb 100644 --- a/plugins/OStatus/classes/FeedSub.php +++ b/plugins/OStatus/classes/FeedSub.php @@ -168,7 +168,7 @@ class FeedSub extends Managed_DataObject $discover->discoverFromFeedURL($feeduri); $huburi = $discover->getHubLink(); - if (!$huburi && !common_config('feedsub', 'fallback_hub')) { + if (!$huburi && !common_config('feedsub', 'fallback_hub') && !common_config('feedsub', 'nohub')) { throw new FeedSubNoHubException(); } @@ -211,8 +211,8 @@ class FeedSub extends Managed_DataObject // No native hub on this feed? // Use our fallback hub, which handles polling on our behalf. } else if (common_config('feedsub', 'nohub')) { - // Fake it! We're just testing remote feeds w/o hubs. - // We'll never actually get updates in this mode. + // For this to actually work, we'll need some polling mechanism. + // The FeedPoller plugin should take care of it. return; } else { // TRANS: Server exception. @@ -247,8 +247,8 @@ class FeedSub extends Managed_DataObject // No native hub on this feed? // Use our fallback hub, which handles polling on our behalf. } else if (common_config('feedsub', 'nohub')) { - // Fake it! We're just testing remote feeds w/o hubs. - // We'll never actually get updates in this mode. + // We need a feedpolling plugin (like FeedPoller) active so it will + // set the 'nohub' state to 'inactive' for us. return; } else { // TRANS: Server exception. diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 6f5380e68a..b94950138f 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -1141,8 +1141,9 @@ class Ostatus_profile extends Managed_DataObject ?: $discover->getAtomLink(Salmon::NS_REPLIES); $hints['salmon'] = $salmonuri; - if (!$huburi && !common_config('feedsub', 'fallback_hub')) { + if (!$huburi && !common_config('feedsub', 'fallback_hub') && !common_config('feedsub', 'nohub')) { // We can only deal with folks with a PuSH hub + // unless we have something similar available locally. throw new FeedSubNoHubException(); } @@ -1534,7 +1535,7 @@ class Ostatus_profile extends Managed_DataObject $huburi = $discover->getHubLink(); } - if (!$huburi && !common_config('feedsub', 'fallback_hub')) { + if (!$huburi && !common_config('feedsub', 'fallback_hub') && !common_config('feedsub', 'nohub')) { // We can only deal with folks with a PuSH hub throw new FeedSubNoHubException(); } -- 2.39.5