diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/connedit.php | 7 | ||||
-rw-r--r-- | mod/follow.php | 8 | ||||
-rw-r--r-- | mod/import.php | 15 |
3 files changed, 29 insertions, 1 deletions
diff --git a/mod/connedit.php b/mod/connedit.php index d50783d31..008bc21ac 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -322,6 +322,9 @@ function connedit_clone(&$a) { if(! $a->poi) return; + + $channel = $a->get_channel(); + $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_id = %d LIMIT 1", @@ -338,6 +341,10 @@ function connedit_clone(&$a) { unset($clone['abook_account']); unset($clone['abook_channel']); + $abconfig = load_abconfig($channel['channel_hash'],$clone['abook_xchan']); + if($abconfig) + $clone['abconfig'] = $abconfig; + build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone))); } diff --git a/mod/follow.php b/mod/follow.php index 3ad2cb3bb..73e87c16f 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -14,7 +14,9 @@ function follow_init(&$a) { $return_url = $_SESSION['return_url']; $confirm = intval($_REQUEST['confirm']); - $result = new_contact($uid,$url,$a->get_channel(),true,$confirm); + $channel = $a->get_channel(); + + $result = new_contact($uid,$url,$channel,true,$confirm); if($result['success'] == false) { if($result['message']) @@ -34,6 +36,10 @@ function follow_init(&$a) { unset($clone['abook_account']); unset($clone['abook_channel']); + $abconfig = load_abconfig($channel['channel_hash'],$clone['abook_xchan']); + if($abconfig) + $clone['abconfig'] = $abconfig; + build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone))); diff --git a/mod/import.php b/mod/import.php index 184159585..0b239d822 100644 --- a/mod/import.php +++ b/mod/import.php @@ -341,6 +341,10 @@ function import_account(&$a, $account_id) { if($abooks) { foreach($abooks as $abook) { + $abconfig = null; + if(array_key_exists('abconfig',$abook) && is_array($abook['abconfig']) && count($abook['abconfig'])) + $abconfig = $abook['abconfig']; + unset($abook['abook_id']); unset($abook['abook_rating']); unset($abook['abook_rating_text']); @@ -382,6 +386,17 @@ function import_account(&$a, $account_id) { $friends ++; if(intval($abook['abook_feed'])) $feeds ++; + + if($abconfig) { + // @fixme does not handle sync of del_abconfig + foreach($abconfig as $abc) { + if($abc['chan'] === $channel['channel_hash']) + set_abconfig($abc['chan'],$abc['xchan'],$abc['cat'],$abc['k'],$abc['v']); + } + } + + + } } logger('import step 8'); |