From 065a50c920ebfe2274ab134bca7849051f3582e7 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 2 Jul 2015 21:55:36 -0700 Subject: a few clone sync fixes as well as some work on hubzilla clone sync back to redmatrix --- include/diaspora.php | 14 ++++++++++++++ include/zot.php | 22 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) (limited to 'include') diff --git a/include/diaspora.php b/include/diaspora.php index 77a400604..cf8d89023 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -818,11 +818,25 @@ function diaspora_request($importer,$xml) { 'link' => z_root() . '/connedit/' . $new_connection[0]['abook_id'], )); + if($default_perms) { // Send back a sharing notification to them diaspora_share($importer,$new_connection[0]); } + + $clone = array(); + foreach($new_connection[0] as $k => $v) { + if(strpos($k,'abook_') === 0) { + $clone[$k] = $v; + } + } + unset($clone['abook_id']); + unset($clone['abook_account']); + unset($clone['abook_channel']); + + build_sync_packet($importer['channel_id'], array('abook' => array($clone))); + } } diff --git a/include/zot.php b/include/zot.php index 66156b4e0..34e7f3e42 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2922,6 +2922,28 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { foreach($arr['abook'] as $abook) { + if(array_key_exists('abook_blocked',$abook)) { + // convert from hubzilla + $abook['abook_flags'] = 0; + if(intval($abook['abook_blocked'])) + $abook['abook_flags'] |= ABOOK_FLAG_BLOCKED; + if(intval($abook['abook_ignored'])) + $abook['abook_flags'] |= ABOOK_FLAG_IGNORED; + if(intval($abook['abook_hidden'])) + $abook['abook_flags'] |= ABOOK_FLAG_HIDDEN; + if(intval($abook['abook_archived'])) + $abook['abook_flags'] |= ABOOK_FLAG_ARCHIVED; + if(intval($abook['abook_pending'])) + $abook['abook_flags'] |= ABOOK_FLAG_PENDING; + if(intval($abook['abook_unconnected'])) + $abook['abook_flags'] |= ABOOK_FLAG_UNCONNECTED; + if(intval($abook['abook_self'])) + $abook['abook_flags'] |= ABOOK_FLAG_SELF; + if(intval($abook['abook_feed'])) + $abook['abook_flags'] |= ABOOK_FLAG_FEED; + + } + $clean = array(); if($abook['abook_xchan'] && $abook['entry_deleted']) { logger('process_channel_sync_delivery: removing abook entry for ' . $abook['abook_xchan']); -- cgit v1.2.3