diff options
author | friendica <info@friendica.com> | 2012-10-31 21:42:20 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-10-31 21:42:20 -0700 |
commit | 77c30972cbdba4f1b29cdce05c362dd1975dfc41 (patch) | |
tree | 517720d8e892234f61a0102c2633a9db3a062c71 | |
parent | 78f64c90a353606b0a46185d07e65359eebe99ad (diff) | |
download | volse-hubzilla-77c30972cbdba4f1b29cdce05c362dd1975dfc41.tar.gz volse-hubzilla-77c30972cbdba4f1b29cdce05c362dd1975dfc41.tar.bz2 volse-hubzilla-77c30972cbdba4f1b29cdce05c362dd1975dfc41.zip |
network discovery on follow
-rw-r--r-- | include/follow.php | 18 | ||||
-rw-r--r-- | include/zot.php | 2 | ||||
-rw-r--r-- | mod/follow.php | 2 |
3 files changed, 15 insertions, 7 deletions
diff --git a/include/follow.php b/include/follow.php index 4c835c8a7..8bea21ebc 100644 --- a/include/follow.php +++ b/include/follow.php @@ -2,28 +2,28 @@ // -// Takes a $uid and a url/handle and adds a new channel +// Takes a $uid and the channel associated with the uid, and a url/handle and adds a new channel // Returns an array // $return['success'] boolean true if successful // $return['abook_id'] Address book ID if successful // $return['message'] error text if success is false. +require_once('include/zot.php'); - -function new_contact($uid,$url,$interactive = false) { +function new_contact($uid,$url,$channel.$interactive = false) { $result = array('success' => false,'message' => ''); $a = get_app(); if(! allowed_url($url)) { - $result['message'] = t('Disallowed profile URL.'); + $result['message'] = t('Channel is blocked on this site.'); return $result; } if(! $url) { - $result['message'] = t('Connect URL missing.'); + $result['message'] = t('Channel location missing.'); return $result; } @@ -34,9 +34,15 @@ function new_contact($uid,$url,$interactive = false) { if(x($arr['contact'],'name')) $ret = $arr['contact']; else - $ret = zot_probe_url($url); + $ret = zot_finger($url,$channel,false); + + if($ret['success']) { + $j = json_decode($ret['body']); + } +// logger('follow: ' . print_r($j,true)); + killme(); if($ret['network'] === NETWORK_DFRN) { diff --git a/include/zot.php b/include/zot.php index 6d48f1e7c..8d3fafcc8 100644 --- a/include/zot.php +++ b/include/zot.php @@ -74,6 +74,8 @@ function zot_notify($channel,$url) { function zot_finger($webbie,$channel) { + + logger('zot_finger:' . print_r($channel,true)); if(strpos($webbie,'@') === false) { $address = $webbie; $host = get_app()->get_hostname(); diff --git a/mod/follow.php b/mod/follow.php index 0b222e505..05d1eee73 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -16,7 +16,7 @@ function follow_init(&$a) { $return_url = $_SESSION['return_url']; - $result = new_contact($uid,$url,true); + $result = new_contact($uid,$url,$a->get_channel(),true); if($result['success'] == false) { if($result['message']) |