diff options
author | friendica <info@friendica.com> | 2014-02-09 19:45:22 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-02-09 19:45:22 -0800 |
commit | c7ffae03d83d9af29507c820a9b7a909db7546f7 (patch) | |
tree | d04d4ba6059337e02f3d347fbd985bfd0e0b4cdb | |
parent | cf3b76c0460888c56263f0f03a2115c7c666b8c7 (diff) | |
download | volse-hubzilla-c7ffae03d83d9af29507c820a9b7a909db7546f7.tar.gz volse-hubzilla-c7ffae03d83d9af29507c820a9b7a909db7546f7.tar.bz2 volse-hubzilla-c7ffae03d83d9af29507c820a9b7a909db7546f7.zip |
perform remote discovery on abook sync of nomadic clones if remote channel (xchan) is unknown
-rw-r--r-- | include/zot.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/zot.php b/include/zot.php index b7a22a099..7dfaada32 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2108,6 +2108,33 @@ function process_channel_sync_delivery($sender,$arr,$deliveries) { $clean = array(); foreach($arr['abook'] as $abook) { + + // Perform discovery if the referenced xchan hasn't ever been seen on this hub. + // This relies on the undocumented behaviour that red sites send xchan info with the abook + + if($abook['abook_xchan'] && $abook['xchan_address']) { + $h = zot_get_hublocs($abook['abook_xchan']); + if(! $h) { + $f = zot_finger($abook['xchan_address'],$channel); + if(! $f['success']) { + logger('process_channel_sync_delivery: abook not probe-able' . $abook['xchan_address']); + continue; + } + $j = json_decode($f['body'],true); + if(! ($j['success'] && $j['guid'])) { + logger('process_channel_sync_delivery: probe failed.'); + continue; + } + + $x = import_xchan($j); + + if(! $x['success']) { + logger('process_channel_sync_delivery: import failed.'); + continue; + } + } + } + foreach($abook as $k => $v) { if(in_array($k,$disallowed) || (strpos($k,'abook') !== 0)) continue; |