aboutsummaryrefslogtreecommitdiffstats
path: root/include/follow.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2017-10-25 13:29:19 +0200
committerMario <mario@mariovavti.com>2017-10-25 13:29:19 +0200
commit344aa13c64f0fa7a246f3284bf9cdb267e6101d3 (patch)
tree943809c01164dda7b6e4a26bc3d6c7e8c48bd6eb /include/follow.php
parent61c86212b944efa0d78dcc0364b81bfb8a0d19bc (diff)
parent69b22e3f7916b5ba19b5ed03a55ad72bf5995291 (diff)
downloadvolse-hubzilla-344aa13c64f0fa7a246f3284bf9cdb267e6101d3.tar.gz
volse-hubzilla-344aa13c64f0fa7a246f3284bf9cdb267e6101d3.tar.bz2
volse-hubzilla-344aa13c64f0fa7a246f3284bf9cdb267e6101d3.zip
Merge branch '2.8RC'
Diffstat (limited to 'include/follow.php')
-rw-r--r--include/follow.php28
1 files changed, 22 insertions, 6 deletions
diff --git a/include/follow.php b/include/follow.php
index 9e2fd6a9c..56d8294c5 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -17,6 +17,17 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
$my_perms = false;
$is_zot = false;
+ $protocol = '';
+
+
+ if(substr($url,0,1) === '[') {
+ $x = strpos($url,']');
+ if($x) {
+ $protocol = substr($url,1,$x-1);
+ $url = substr($url,$x+1);
+ }
+ }
+
$is_http = ((strpos($url,'://') !== false) ? true : false);
if($is_http && substr($url,-1,1) === '/')
@@ -47,13 +58,13 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
}
- $arr = array('url' => $url, 'channel' => array());
+ $arr = array('url' => $url, 'protocol', 'channel' => array());
call_hooks('follow_init', $arr);
if($arr['channel']['success'])
$ret = $arr['channel'];
- elseif(! $is_http)
+ elseif((! $is_http) && ((! $protocol) || (strtolower($protocol) === 'zot')))
$ret = Zotlabs\Zot\Finger::run($url,$channel);
if($ret && is_array($ret) && $ret['success']) {
@@ -118,26 +129,31 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
else {
$xchan_hash = '';
+ $sql_options = (($protocol) ? " and xchan_network = '" . dbesc($protocol) . "' " : '');
+
- $r = q("select * from xchan where xchan_hash = '%s' or xchan_url = '%s' limit 1",
+ $r = q("select * from xchan where xchan_hash = '%s' or xchan_url = '%s' $sql_options limit 1",
dbesc($url),
dbesc($url)
);
if(! $r) {
+
// attempt network auto-discovery
- $d = discover_by_webbie($url);
+ $d = discover_by_webbie($url,$protocol);
if((! $d) && ($is_http)) {
// try RSS discovery
- if(get_config('system','feed_contacts')) {
+ $feeds = get_config('system','feed_contacts');
+
+ if(($feeds) && ($protocol === '' || $protocol === 'feed')) {
$d = discover_by_url($url);
}
else {
- $result['message'] = t('Protocol disabled.');
+ $result['message'] = t('Remote channel or protocol unavailable.');
return $result;
}
}