From f0a2747d80b29810eddeb62063c231d7178ac3db Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 4 May 2017 21:55:56 -0700 Subject: make service_plink pluggable --- include/network.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/network.php b/include/network.php index d4b9e73ee..5bf626908 100644 --- a/include/network.php +++ b/include/network.php @@ -1980,3 +1980,26 @@ function scrape_vcard($url) { return $ret; } + +function service_plink($contact, $guid) { + + $plink = ''; + + $m = parse_url($contact['xchan_url']); + if($m) { + $url = $m['scheme'] . '://' . $m['host'] . (($m['port']) ? ':' . $m['port'] : ''); + } + else { + $url = 'https://' . substr($contact['xchan_addr'],strpos($contact['xchan_addr'],'@')+1); + } + + $handle = substr($contact['xchan_addr'], 0, strpos($contact['xchan_addr'],'@')); + + $plink = $url . '/channel/' . $handle . '?f=&mid=' . $guid; + + $x = [ 'xchan' => $contact, 'guid' => $guid, '$url' => $url, 'plink' => $plink ]; + call_hooks('service_plink', $x); + + return $x['plink']; +} + -- cgit v1.2.3