diff options
author | marijus <mario@localhost.localdomain> | 2013-12-16 12:51:35 +0100 |
---|---|---|
committer | marijus <mario@localhost.localdomain> | 2013-12-16 12:51:35 +0100 |
commit | 5512d6aa1df61e0cdab31a2758d3a865ddfbc280 (patch) | |
tree | 1f2d763c495ad5192456d54036eb3dcc8fafb595 /mod/magic.php | |
parent | c3c7a068332ae08aea5eeb8eaf820e34c9cf210b (diff) | |
parent | a7a775a718ef92c9bd623849baab1e386071d70b (diff) | |
download | volse-hubzilla-5512d6aa1df61e0cdab31a2758d3a865ddfbc280.tar.gz volse-hubzilla-5512d6aa1df61e0cdab31a2758d3a865ddfbc280.tar.bz2 volse-hubzilla-5512d6aa1df61e0cdab31a2758d3a865ddfbc280.zip |
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'mod/magic.php')
-rw-r--r-- | mod/magic.php | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/mod/magic.php b/mod/magic.php index 03d09e70d..aead559a7 100644 --- a/mod/magic.php +++ b/mod/magic.php @@ -33,21 +33,28 @@ function magic_init(&$a) { if(! $x) { - // Somebody new? Finger them if they've never been seen here before - - if($addr) { - $ret = zot_finger($addr,null); - if($ret['success']) { - $j = json_decode($ret['body'],true); - if($j) - import_xchan($j); - - // Now try again - - $x = q("select * from hubloc where hubloc_url = '%s' order by hubloc_connected desc limit 1", - dbesc($basepath) - ); - } + /* + * We have no records for, or prior communications with this hub. + * If an address was supplied, let's finger them to create a hub record. + * Otherwise we'll use the special address '[system]' which will return + * either a system channel or the first available normal channel. We don't + * really care about what channel is returned - we need the hub information + * from that response so that we can create signed auth packets destined + * for that hub. + * + */ + + $ret = zot_finger((($addr) ? $addr : '[system]@' . $parsed['host']),null); + if($ret['success']) { + $j = json_decode($ret['body'],true); + if($j) + import_xchan($j); + + // Now try again + + $x = q("select * from hubloc where hubloc_url = '%s' order by hubloc_connected desc limit 1", + dbesc($basepath) + ); } } |