re-organise the protocol disabled logic
This commit is contained in:
parent
2540ecc0ac
commit
76d41fc250
@ -133,27 +133,27 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
|
|||||||
$their_perms = 0;
|
$their_perms = 0;
|
||||||
$xchan_hash = '';
|
$xchan_hash = '';
|
||||||
|
|
||||||
|
|
||||||
$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' limit 1",
|
||||||
dbesc($url),
|
dbesc($url),
|
||||||
dbesc($url)
|
dbesc($url)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if(! $r) {
|
if(! $r) {
|
||||||
// attempt network auto-discovery
|
// attempt network auto-discovery
|
||||||
if(strpos($url,'@') && (! $is_http)) {
|
if(strpos($url,'@') && (! $is_http)) {
|
||||||
$r = discover_by_webbie($url);
|
$d = discover_by_webbie($url);
|
||||||
}
|
}
|
||||||
elseif($is_http) {
|
elseif($is_http) {
|
||||||
$r = discover_by_url($url);
|
if(get_config('system','feed_contacts'))
|
||||||
$r['allowed'] = intval(get_config('system','feed_contacts'));
|
$d = discover_by_url($url);
|
||||||
}
|
else {
|
||||||
if($r) {
|
|
||||||
$r['channel_id'] = $uid;
|
|
||||||
call_hooks('follow_allow',$r);
|
|
||||||
if(! $r['allowed']) {
|
|
||||||
$result['message'] = t('Protocol disabled.');
|
$result['message'] = t('Protocol disabled.');
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if($d) {
|
||||||
$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' limit 1",
|
||||||
dbesc($url),
|
dbesc($url),
|
||||||
dbesc($url)
|
dbesc($url)
|
||||||
@ -172,6 +172,16 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$x = array('channel_id' => $uid, 'follow_address' => $url, 'xchan' => $r[0], 'allowed' => 1);
|
||||||
|
|
||||||
|
call_hooks('follow_allow',$x);
|
||||||
|
|
||||||
|
if(! $x['allowed']) {
|
||||||
|
$result['message'] = t('Protocol disabled.');
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if((local_channel()) && $uid == local_channel()) {
|
if((local_channel()) && $uid == local_channel()) {
|
||||||
$aid = get_account_id();
|
$aid = get_account_id();
|
||||||
$hash = get_observer_hash();
|
$hash = get_observer_hash();
|
||||||
|
Reference in New Issue
Block a user