aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-05-20 20:20:35 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-05-20 20:20:35 -0700
commit62df06b3d6b2e56d271b69bebf8427caa715dd16 (patch)
tree24f269749200e3501d14082e76815640dd98a2d0 /include
parent06898167720158604f1c3d1d2e19a591208c607a (diff)
downloadvolse-hubzilla-62df06b3d6b2e56d271b69bebf8427caa715dd16.tar.gz
volse-hubzilla-62df06b3d6b2e56d271b69bebf8427caa715dd16.tar.bz2
volse-hubzilla-62df06b3d6b2e56d271b69bebf8427caa715dd16.zip
cloning abook entries was broken in several ways if the target xchan wasn't available on the clone site. This should make it less broken.
Diffstat (limited to 'include')
-rwxr-xr-xinclude/items.php8
-rw-r--r--include/zot.php21
2 files changed, 13 insertions, 16 deletions
diff --git a/include/items.php b/include/items.php
index d0b647a92..3936f1a6f 100755
--- a/include/items.php
+++ b/include/items.php
@@ -971,6 +971,14 @@ function import_author_diaspora($x) {
if(! $x['address'])
return false;
+ $r = q("select * from xchan where xchan_addr = '%s' limit 1",
+ dbesc($x['address'])
+ );
+ if($r) {
+ logger('in_cache: ' . $x['address'], LOGGER_DATA);
+ return $r[0]['chan_hash'];
+ }
+
if(discover_by_webbie($x['address'])) {
$r = q("select xchan_hash from xchan where xchan_addr = '%s' limit 1",
dbesc($x['address'])
diff --git a/include/zot.php b/include/zot.php
index 3c7413b5c..d719f3177 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -2926,25 +2926,14 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
// 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
+ // and import_author_xchan will look them up on all federated networks
- if($abook['abook_xchan'] && $abook['xchan_address']) {
+ if($abook['abook_xchan'] && $abook['xchan_addr']) {
$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.');
+ $xhash = import_author_xchan(encode_item_xchan($abook));
+ if(! $xhash) {
+ logger('process_channel_sync_delivery: import of ' . $abook['xchan_addr'] . ' failed.');
continue;
}
}