]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into nightly
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 14 Dec 2015 21:11:26 +0000 (22:11 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 14 Dec 2015 21:11:26 +0000 (22:11 +0100)
plugins/OStatus/OStatusPlugin.php
plugins/OStatus/actions/ostatussub.php
plugins/OStatus/classes/Ostatus_profile.php
plugins/TwitterBridge/TwitterBridgePlugin.php
plugins/TwitterBridge/lib/twitterimport.php
plugins/TwitterBridge/twitter.php

index 7db385b1a9a94e8b439532955e4fcb4c9665a512..c3307f23cbcb021dec2378f4391a146ba59cbca5 100644 (file)
@@ -444,6 +444,17 @@ class OStatusPlugin extends Plugin
         return null;
     }
 
+    function onEndProfileSettingsActions($out) {
+        $siteName = common_config('site', 'name');
+        $js = 'navigator.registerContentHandler("application/vnd.mozilla.maybe.feed", "'.addslashes(common_local_url('ostatussub', null, array('profile' => '%s'))).'", "'.addslashes($siteName).'")';
+        $out->elementStart('li');
+        $out->element('a',
+                      array('href' => 'javascript:'.$js),
+                      // TRANS: Option in profile settings to add this instance to Firefox as a feedreader
+                      _('Add to Firefox as feedreader'));
+        $out->elementEnd('li');
+    }
+
     /**
      * Make sure necessary tables are filled out.
      */
index 6078f70b715871012e4bf010993f422201417ac4..b0c088e55d50872fb10a516a2e6a6229c0a2e574 100644 (file)
@@ -281,6 +281,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 4d1c676844c51c5e9736dcc1b043a7525cbc2873..fa6170cfdf1bccd468282e8ae4e5c738e0698208 100644 (file)
@@ -635,14 +635,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
index dd3007e309400a3b3456e7b9255034830e9f65db..72c28d4fa45eb4dfc4eefbaa1528cc357bf9055e 100644 (file)
@@ -527,6 +527,23 @@ class TwitterBridgePlugin extends Plugin
 
     public function onEndShowHeadElements(Action $action)
     {
+        if($action instanceof ShowNoticeAction) { // Showing a notice
+            $notice = Notice::getKV('id', $action->arg('notice'));
+
+            try {
+                $flink = Foreign_link::getByUserID($notice->profile_id, TWITTER_SERVICE);
+                $fuser = Foreign_user::getForeignUser($flink->foreign_id, TWITTER_SERVICE);
+            } catch (NoResultException $e) {
+                return true;
+            }
+
+            $statusId = twitter_status_id($notice);
+            if($notice instanceof Notice && $notice->isLocal() && $statusId) {
+                $tweetUrl = 'https://twitter.com/' . $fuser->nickname . '/status/' . $statusId;
+                $action->element('link', array('rel' => 'syndication', 'href' => $tweetUrl));
+            }
+        }
+
         if (!($action instanceof AttachmentAction)) {
             return true;
         }
index 82132c1abe4b3777ce8b5cbc7a79b14cb75ddc8b..f99120a929255f2276f65492148889b91ac53fa2 100644 (file)
@@ -221,7 +221,7 @@ class TwitterImport
      */
     function makeStatusURI($username, $id)
     {
-        return 'http://twitter.com/#!/'
+        return 'https://twitter.com/'
           . $username
           . '/status/'
           . $id;
@@ -245,7 +245,10 @@ class TwitterImport
         $profile->limit(1);
 
         if (!$profile->find(true)) {
-            throw new NoResultException($profile);
+            $profile->profileurl = str_replace('https://', 'http://', $profileurl);
+            if (!$profile->find(true)) {
+                throw new NoResultException($profile);
+            }
         }
         return $profile;
     }
@@ -253,7 +256,7 @@ class TwitterImport
     protected function ensureProfile($twuser)
     {
         // check to see if there's already a profile for this user
-        $profileurl = 'http://twitter.com/' . $twuser->screen_name;
+        $profileurl = 'https://twitter.com/' . $twuser->screen_name;
         try {
             $profile = $this->getProfileByUrl($twuser->screen_name, $profileurl);
             $this->updateAvatar($twuser, $profile);
@@ -539,9 +542,9 @@ class TwitterImport
     static function atLink($screenName, $fullName, $orig)
     {
         if (!empty($fullName)) {
-            return "<a href='http://twitter.com/#!/{$screenName}' title='{$fullName}'>{$orig}</a>";
+            return "<a href='https://twitter.com/{$screenName}' title='{$fullName}'>{$orig}</a>";
         } else {
-            return "<a href='http://twitter.com/#!/{$screenName}'>{$orig}</a>";
+            return "<a href='https://twitter.com/{$screenName}'>{$orig}</a>";
         }
     }
 
index 0f1e686ac8865b35548cf5f0de62f6904372d8ea..6b7e2179e66d6c4657710df326388a5f3e8b5bf5 100644 (file)
@@ -124,8 +124,7 @@ function is_twitter_bound($notice, $flink) {
         // If it's not a Twitter-style reply, or if the user WANTS to send replies,
         // or if it's in reply to a twitter notice
         if ( (($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) == FOREIGN_NOTICE_SEND_REPLY) ||
-              ((is_twitter_notice($notice->reply_to) || is_twitter_notice($notice->repeat_of))
-              && (($flink->noticesync & FOREIGN_NOTICE_RECV) == FOREIGN_NOTICE_RECV)) ||
+               is_twitter_notice($notice->reply_to) || is_twitter_notice($notice->repeat_of) ||
              (empty($notice->reply_to) && !preg_match('/^@[a-zA-Z0-9_]{1,15}\b/u', $notice->content)) ){
             return true;
         }