function find_diaspora_person_by_handle($handle) { $person = false; $refresh = false; if (diaspora_is_blacklisted($handle)) { return false; } $r = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' limit 1", dbesc($handle)); if ($r) { $person = $r[0]; logger('find_diaspora_person_by handle: in cache ' . print_r($r, true), LOGGER_DATA, LOG_DEBUG); if ($person['xchan_name_date'] < datetime_convert('UTC', 'UTC', 'now - 1 month')) { logger('Updating Diaspora cached record for ' . $handle); $refresh = true; } } if (!$person || $refresh) { // try webfinger. Make sure to distinguish between diaspora, // hubzilla w/diaspora protocol and friendica w/diaspora protocol. $result = discover_by_webbie($handle); if ($result) { $r = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' limit 1", dbesc(str_replace('acct:', '', $handle))); if ($r) { $person = $r[0]; logger('find_diaspora_person_by handle: discovered ' . print_r($r, true), LOGGER_DATA, LOG_DEBUG); } } } return $person; }
function find_diaspora_person_by_handle($handle) { $person = false; if (diaspora_is_blacklisted($handle)) { return false; } $r = q("select * from xchan where xchan_addr = '%s' limit 1", dbesc($handle)); if ($r) { $person = $r[0]; logger('find_diaspora_person_by handle: in cache ' . print_r($r, true), LOGGER_DATA); } if (!$person) { // try webfinger. Make sure to distinguish between diaspora, // redmatrix w/diaspora protocol and friendica w/diaspora protocol. $result = discover_by_webbie($handle); if ($result) { $r = q("select * from xchan where xchan_addr = '%s' limit 1", dbesc($handle)); if ($r) { $person = $r[0]; logger('find_diaspora_person_by handle: discovered ' . print_r($r, true), LOGGER_DATA); } } } return $person; }