]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
If we are given a direct URL to a feed, use that
authorStephen Paul Weber <singpolyma@singpolyma.net>
Wed, 28 Oct 2015 00:54:20 +0000 (00:54 +0000)
committerStephen Paul Weber <singpolyma@singpolyma.net>
Wed, 28 Oct 2015 00:54:20 +0000 (00:54 +0000)
plugins/OStatus/actions/ostatussub.php
plugins/OStatus/classes/Ostatus_profile.php

index f349b5d534800084231f04846646ed5716d0e149..8fc1e2e25f38cbb86978a929d4e090186315a6f2 100644 (file)
@@ -280,6 +280,10 @@ class OStatusSubAction extends Action
             // TRANS: Error text.
             $this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
             common_debug('Not a recognized feed type.', __FILE__);
+        } catch (FeedSubNoHubException $e) {
+            // TRANS: Error text.
+            $this->error = _m("Sorry, that feed is not Pubsubhubub enabled.");
+            common_debug('No hub found.', __FILE__);
         } catch (Exception $e) {
             // Any new ones we forgot about
                 // TRANS: Error message in OStatus plugin. Do not translate the domain names example.com
index 1c4428b16df7ed17e1e90949c9d452ef9f5f383e..efcacd7979ee935bd6da709c0a6d75c94131b870 100644 (file)
@@ -810,14 +810,21 @@ class Ostatus_profile extends Managed_DataObject
             }
         }
 
-        // Try to get some hCard data
+        if (in_array(
+            preg_replace('/\s*;.*$/', '', $response->getHeader('Content-Type')),
+            array('application/rss+xml', 'application/atom+xml', 'application/xml', 'text/xml'))
+        ) {
+            $hints['feedurl'] = $response->getUrl();
+        } else {
+            // Try to get some hCard data
 
-        $body = $response->getBody();
+            $body = $response->getBody();
 
-        $hcardHints = DiscoveryHints::hcardHints($body, $finalUrl);
+            $hcardHints = DiscoveryHints::hcardHints($body, $finalUrl);
 
-        if (!empty($hcardHints)) {
-            $hints = array_merge($hints, $hcardHints);
+            if (!empty($hcardHints)) {
+                $hints = array_merge($hints, $hcardHints);
+            }
         }
 
         // Check if they've got an LRDD header