diff options
author | redmatrix <git@macgirvin.com> | 2016-02-29 19:31:52 -0800 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-02-29 19:31:52 -0800 |
commit | be2b7c0b5f7f9b8080affbb4bc44c5adda18e82f (patch) | |
tree | 6dde06168b0df62044a3fdeaf2b4b9b649165d7a /mod | |
parent | 44b2503572700ab24e7afad4637f62c413d3d489 (diff) | |
download | volse-hubzilla-be2b7c0b5f7f9b8080affbb4bc44c5adda18e82f.tar.gz volse-hubzilla-be2b7c0b5f7f9b8080affbb4bc44c5adda18e82f.tar.bz2 volse-hubzilla-be2b7c0b5f7f9b8080affbb4bc44c5adda18e82f.zip |
abconfig
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'); |