Merge branch 'master' into nightly

This commit is contained in:
Mikael Nordfeldth 2015-12-14 22:11:26 +01:00
commit 0d39337683
6 changed files with 53 additions and 12 deletions

View File

@ -444,6 +444,17 @@ class OStatusPlugin extends Plugin
return null; 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. * Make sure necessary tables are filled out.
*/ */

View File

@ -281,6 +281,10 @@ class OStatusSubAction extends Action
// TRANS: Error text. // TRANS: Error text.
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later."); $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__); 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) { } catch (Exception $e) {
// Any new ones we forgot about // Any new ones we forgot about
// TRANS: Error message in OStatus plugin. Do not translate the domain names example.com // TRANS: Error message in OStatus plugin. Do not translate the domain names example.com

View File

@ -635,6 +635,12 @@ class Ostatus_profile extends Managed_DataObject
} }
} }
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 // Try to get some hCard data
$body = $response->getBody(); $body = $response->getBody();
@ -644,6 +650,7 @@ class Ostatus_profile extends Managed_DataObject
if (!empty($hcardHints)) { if (!empty($hcardHints)) {
$hints = array_merge($hints, $hcardHints); $hints = array_merge($hints, $hcardHints);
} }
}
// Check if they've got an LRDD header // Check if they've got an LRDD header

View File

@ -527,6 +527,23 @@ class TwitterBridgePlugin extends Plugin
public function onEndShowHeadElements(Action $action) 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)) { if (!($action instanceof AttachmentAction)) {
return true; return true;
} }

View File

@ -221,7 +221,7 @@ class TwitterImport
*/ */
function makeStatusURI($username, $id) function makeStatusURI($username, $id)
{ {
return 'http://twitter.com/#!/' return 'https://twitter.com/'
. $username . $username
. '/status/' . '/status/'
. $id; . $id;
@ -244,16 +244,19 @@ class TwitterImport
$profile->profileurl = $profileurl; $profile->profileurl = $profileurl;
$profile->limit(1); $profile->limit(1);
if (!$profile->find(true)) {
$profile->profileurl = str_replace('https://', 'http://', $profileurl);
if (!$profile->find(true)) { if (!$profile->find(true)) {
throw new NoResultException($profile); throw new NoResultException($profile);
} }
}
return $profile; return $profile;
} }
protected function ensureProfile($twuser) protected function ensureProfile($twuser)
{ {
// check to see if there's already a profile for this user // 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 { try {
$profile = $this->getProfileByUrl($twuser->screen_name, $profileurl); $profile = $this->getProfileByUrl($twuser->screen_name, $profileurl);
$this->updateAvatar($twuser, $profile); $this->updateAvatar($twuser, $profile);
@ -539,9 +542,9 @@ class TwitterImport
static function atLink($screenName, $fullName, $orig) static function atLink($screenName, $fullName, $orig)
{ {
if (!empty($fullName)) { 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 { } else {
return "<a href='http://twitter.com/#!/{$screenName}'>{$orig}</a>"; return "<a href='https://twitter.com/{$screenName}'>{$orig}</a>";
} }
} }

View 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, // 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 // or if it's in reply to a twitter notice
if ( (($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) == FOREIGN_NOTICE_SEND_REPLY) || if ( (($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) == FOREIGN_NOTICE_SEND_REPLY) ||
((is_twitter_notice($notice->reply_to) || is_twitter_notice($notice->repeat_of)) is_twitter_notice($notice->reply_to) || is_twitter_notice($notice->repeat_of) ||
&& (($flink->noticesync & FOREIGN_NOTICE_RECV) == FOREIGN_NOTICE_RECV)) ||
(empty($notice->reply_to) && !preg_match('/^@[a-zA-Z0-9_]{1,15}\b/u', $notice->content)) ){ (empty($notice->reply_to) && !preg_match('/^@[a-zA-Z0-9_]{1,15}\b/u', $notice->content)) ){
return true; return true;
} }