Commit 0d393376 authored by mmn's avatar mmn

Merge branch 'master' into nightly

parents c2ea85a5 67c0c1b6
......@@ -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.
*/
......
......@@ -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
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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>";
}
}
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment