OStatus: code cleanup on webfinger fallback path
This commit is contained in:
parent
a4d9171306
commit
14065ca350
@ -1306,20 +1306,23 @@ class Ostatus_profile extends Memcached_DataObject
|
|||||||
$result = $disco->lookup($addr);
|
$result = $disco->lookup($addr);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// Save negative cache entry so we don't waste time looking it up again.
|
// Save negative cache entry so we don't waste time looking it up again.
|
||||||
|
// @fixme distinguish temporary failures?
|
||||||
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), null);
|
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), null);
|
||||||
throw new Exception('Not a valid webfinger address.');
|
throw new Exception('Not a valid webfinger address.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$hints = array('webfinger' => $addr);
|
||||||
|
|
||||||
foreach ($result->links as $link) {
|
foreach ($result->links as $link) {
|
||||||
switch ($link['rel']) {
|
switch ($link['rel']) {
|
||||||
case Discovery::PROFILEPAGE:
|
case Discovery::PROFILEPAGE:
|
||||||
$profileUrl = $link['href'];
|
$hints['profileurl'] = $profileUrl = $link['href'];
|
||||||
break;
|
break;
|
||||||
case Salmon::NS_REPLIES:
|
case Salmon::NS_REPLIES:
|
||||||
$salmonEndpoint = $link['href'];
|
$hints['salmon'] = $salmonEndpoint = $link['href'];
|
||||||
break;
|
break;
|
||||||
case Discovery::UPDATESFROM:
|
case Discovery::UPDATESFROM:
|
||||||
$feedUrl = $link['href'];
|
$hints['feedurl'] = $feedUrl = $link['href'];
|
||||||
break;
|
break;
|
||||||
case Discovery::HCARD:
|
case Discovery::HCARD:
|
||||||
$hcardUrl = $link['href'];
|
$hcardUrl = $link['href'];
|
||||||
@ -1330,11 +1333,6 @@ class Ostatus_profile extends Memcached_DataObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$hints = array('webfinger' => $addr,
|
|
||||||
'profileurl' => $profileUrl,
|
|
||||||
'feedurl' => $feedUrl,
|
|
||||||
'salmon' => $salmonEndpoint);
|
|
||||||
|
|
||||||
if (isset($hcardUrl)) {
|
if (isset($hcardUrl)) {
|
||||||
$hcardHints = self::slurpHcard($hcardUrl);
|
$hcardHints = self::slurpHcard($hcardUrl);
|
||||||
// Note: Webfinger > hcard
|
// Note: Webfinger > hcard
|
||||||
|
Loading…
Reference in New Issue
Block a user