Merge pull request #7434 from annando/contact-protocol

New functions to check if a contact supports that protocol
This commit is contained in:
Hypolite Petovan 2019-07-27 17:47:54 -04:00 committed by GitHub
commit 8b344141da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 17 deletions

View file

@ -29,6 +29,7 @@ use Friendica\Model\Mail;
use Friendica\Model\PermissionSet;
use Friendica\Model\Profile;
use Friendica\Model\User;
use Friendica\Network\Probe;
use Friendica\Object\Image;
use Friendica\Util\BaseURL;
use Friendica\Util\Crypto;
@ -3041,4 +3042,19 @@ class DFRN
return (strcmp($existing_edited, $update_edited) < 0);
}
/**
* Checks if the given contact url does support DFRN
*
* @param string $url profile url
* @param boolean $update Update the profile
* @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function isSupportedByContactUrl($url, $update = false)
{
$probe = Probe::uri($url, Protocol::DFRN, 0, !$update);
return $probe['network'] == Protocol::DFRN;
}
}