start hooking in the new webfinger/zot merged discovery

This commit is contained in:
redmatrix 2015-09-17 18:36:19 -07:00
parent f0a7a6a1e2
commit cc95c3e9c8

View File

@ -1053,16 +1053,20 @@ function discover_by_webbie($webbie) {
$webbie = strtolower($webbie); $webbie = strtolower($webbie);
$x = webfinger_rfc7033($webbie); $x = webfinger_rfc7033($webbie,true);
if($x && array_key_exists('links',$x) && $x['links']) { if($x && array_key_exists('links',$x) && $x['links']) {
foreach($x['links'] as $link) { foreach($x['links'] as $link) {
if(array_key_exists('rel',$link) && $link['rel'] == 'http://purl.org/zot/protocol') { if(array_key_exists('rel',$link) && $link['rel'] == 'http://purl.org/zot/protocol') {
logger('discover_by_webbie: zot found for ' . $webbie, LOGGER_DEBUG); logger('discover_by_webbie: zot found for ' . $webbie, LOGGER_DEBUG);
$z = z_fetch_url($link['href']); if(array_key_exists('zot',$x) && $x['zot']['success'])
if($z['success']) { $i = import_xchan($x['zot']);
$j = json_decode($z['body'],true); else {
$i = import_xchan($j); $z = z_fetch_url($link['href']);
return true; if($z['success']) {
$j = json_decode($z['body'],true);
$i = import_xchan($j);
return true;
}
} }
} }
} }