summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-02-25 18:52:26 -0800
committerBrion Vibber <brion@pobox.com>2010-02-25 18:52:26 -0800
commit2fa953da22fe932f758882a93106672ab22c1c6d (patch)
tree7724b0de4145e80632714a3c5402efaa8a023b0a
parent2feb09f4346e54805f68a9f677f5a94340875d8e (diff)
parent195e0466ecafaeefab7f8d12e5697e1d46918486 (diff)
Merge branch 'testing' of gitorious.org:statusnet/mainline into testing
-rw-r--r--actions/apitimelinegroup.php18
-rw-r--r--actions/apitimelineuser.php19
-rw-r--r--lib/activity.php2
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php2
-rw-r--r--plugins/OStatus/lib/webfinger.php14
5 files changed, 24 insertions, 31 deletions
diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php
index 0bb4860ea..04456ffea 100644
--- a/actions/apitimelinegroup.php
+++ b/actions/apitimelinegroup.php
@@ -107,8 +107,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
$sitename = common_config('site', 'name');
$avatar = $this->group->homepage_logo;
$title = sprintf(_("%s timeline"), $this->group->nickname);
- $taguribase = TagURI::base();
- $id = "tag:$taguribase:GroupTimeline:" . $this->group->id;
$subtitle = sprintf(
_('Updates from %1$s on %2$s!'),
@@ -138,19 +136,9 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
try {
- // If this was called using an integer ID, i.e.: using the canonical
- // URL for this group's feed, then pass the Group object into the feed,
- // so the OStatus plugin, and possibly other plugins, can access it.
- // Feels sorta hacky. -- Z
+ $atom = new AtomGroupNoticeFeed($this->group);
- $atom = null;
- $id = $this->arg('id');
-
- if (strval(intval($id)) === strval($id)) {
- $atom = new AtomGroupNoticeFeed($this->group);
- } else {
- $atom = new AtomGroupNoticeFeed();
- }
+ // @todo set all this Atom junk up inside the feed class
$atom->setId($id);
$atom->setTitle($title);
@@ -169,6 +157,8 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
$aargs['id'] = $id;
}
+ $atom->setId($this->getSelfUri('ApiTimelineGroup', $aargs));
+
$atom->addLink(
$this->getSelfUri('ApiTimelineGroup', $aargs),
array('rel' => 'self', 'type' => 'application/atom+xml')
diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php
index 3e849cc78..b3ded97c0 100644
--- a/actions/apitimelineuser.php
+++ b/actions/apitimelineuser.php
@@ -116,8 +116,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
$sitename = common_config('site', 'name');
$title = sprintf(_("%s timeline"), $this->user->nickname);
- $taguribase = TagURI::base();
- $id = "tag:$taguribase:UserTimeline:" . $this->user->id;
$link = common_local_url(
'showstream',
array('nickname' => $this->user->nickname)
@@ -148,21 +146,10 @@ class ApiTimelineUserAction extends ApiBareAuthAction
header('Content-Type: application/atom+xml; charset=utf-8');
- // If this was called using an integer ID, i.e.: using the canonical
- // URL for this user's feed, then pass the User object into the feed,
- // so the OStatus plugin, and possibly other plugins, can access it.
- // Feels sorta hacky. -- Z
+ // @todo set all this Atom junk up inside the feed class
- $atom = null;
- $id = $this->arg('id');
-
- if (strval(intval($id)) === strval($id)) {
- $atom = new AtomUserNoticeFeed($this->user);
- } else {
- $atom = new AtomUserNoticeFeed();
- }
+ $atom = new AtomUserNoticeFeed($this->user);
- $atom->setId($id);
$atom->setTitle($title);
$atom->setSubtitle($subtitle);
$atom->setLogo($logo);
@@ -181,6 +168,8 @@ class ApiTimelineUserAction extends ApiBareAuthAction
$aargs['id'] = $id;
}
+ $atom->setId($this->getSelfUri('ApiTimelineUser', $aargs));
+
$atom->addLink(
$this->getSelfUri('ApiTimelineUser', $aargs),
array('rel' => 'self', 'type' => 'application/atom+xml')
diff --git a/lib/activity.php b/lib/activity.php
index b64a82f0a..b20153213 100644
--- a/lib/activity.php
+++ b/lib/activity.php
@@ -517,7 +517,7 @@ class AvatarLink
}
$alink = new AvatarLink();
$alink->type = $avatar->mediatype;
- $alink->height = $avatar->mediatype;
+ $alink->height = $avatar->height;
$alink->width = $avatar->width;
$alink->url = $avatar->displayUrl();
return $alink;
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index 9b7be4e9a..75b4bef41 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -1419,6 +1419,7 @@ class Ostatus_profile extends Memcached_DataObject
if (isset($feedUrl)) {
try {
+ common_log(LOG_INFO, "Discovery on acct:$addr with feed URL $feedUrl");
$oprofile = self::ensureProfile($feedUrl, $hints);
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->uri);
return $oprofile;
@@ -1432,6 +1433,7 @@ class Ostatus_profile extends Memcached_DataObject
if (isset($profileUrl)) {
try {
+ common_log(LOG_INFO, "Discovery on acct:$addr with profile URL $profileUrl");
$oprofile = self::ensureProfile($profileUrl, $hints);
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->uri);
return $oprofile;
diff --git a/plugins/OStatus/lib/webfinger.php b/plugins/OStatus/lib/webfinger.php
index 8d7040310..4b777c9a0 100644
--- a/plugins/OStatus/lib/webfinger.php
+++ b/plugins/OStatus/lib/webfinger.php
@@ -81,11 +81,14 @@ class Webfinger
function getServiceLinks($domain)
{
$url = 'http://'. $domain .'/.well-known/host-meta';
+
$content = $this->fetchURL($url);
+
if (empty($content)) {
common_log(LOG_DEBUG, 'Error fetching host-meta');
return false;
}
+
$result = XRD::parse($content);
// Ensure that the host == domain (spec may include signing later)
@@ -119,6 +122,11 @@ class Webfinger
function fetchURL($url)
{
try {
+ $c = Cache::instance();
+ $content = $c->get('webfinger:url:'.$url);
+ if ($content !== false) {
+ return $content;
+ }
$client = new HTTPClient();
$response = $client->get($url);
} catch (HTTP_Request2_Exception $e) {
@@ -129,7 +137,11 @@ class Webfinger
return false;
}
- return $response->getBody();
+ $body = $response->getBody();
+
+ $c->set('webfinger:url:'.$url, $body);
+
+ return $body;
}
function applyTemplate($template, $id)