summaryrefslogtreecommitdiff
path: root/plugins/OStatus/classes
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-02-25 18:57:12 -0800
committerZach Copley <zach@status.net>2010-02-25 18:57:12 -0800
commitcf61f36e6b313659b3c3fb253972d06c7113f1e8 (patch)
tree25372b7649e125b2ee149da155f2f9fbae169c2e /plugins/OStatus/classes
parentd8d8d59a03ef3fa12a0ea668b4a2f383f80486dc (diff)
parent2fa953da22fe932f758882a93106672ab22c1c6d (diff)
Merge branch 'testing' of gitorious.org:statusnet/mainline into testing
* 'testing' of gitorious.org:statusnet/mainline: OStatus: pull best-sized avatar image (96x96 if found, otherwise largest, otherwise if none labeled takes the first) info about discovery in Ostatus_profile::ensureWebfinger() cache Web responses in Webfinger library
Diffstat (limited to 'plugins/OStatus/classes')
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index c3ea042ff..e1c88bd2c 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -818,8 +818,20 @@ class Ostatus_profile extends Memcached_DataObject
protected static function getActivityObjectAvatar($object, $hints=array())
{
- if ($object->avatar) {
- return $object->avatar;
+ if ($object->avatarLinks) {
+ $best = false;
+ // Take the exact-size avatar, or the largest avatar, or the first avatar if all sizeless
+ foreach ($object->avatarLinks as $avatar) {
+ if ($avatar->width == AVATAR_PROFILE_SIZE && $avatar->height = AVATAR_PROFILE_SIZE) {
+ // Exact match!
+ $best = $avatar;
+ break;
+ }
+ if (!$best || $avatar->width > $best->width) {
+ $best = $avatar;
+ }
+ }
+ return $best->url;
} else if (array_key_exists('avatar', $hints)) {
return $hints['avatar'];
}
@@ -1313,6 +1325,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;
@@ -1326,6 +1339,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;