diff options
author | Mario Vavti <mario@mariovavti.com> | 2021-12-21 10:04:51 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2021-12-21 10:04:51 +0100 |
commit | c36e0805d813121f0587c9f2d585fb32bfd346fa (patch) | |
tree | 8e00f5e09eeb01e2c1b6a670cad3a085a5b7ae7a | |
parent | 5c560411857ab4c8b7907e4dd0c0551df537d4e7 (diff) | |
download | volse-hubzilla-c36e0805d813121f0587c9f2d585fb32bfd346fa.tar.gz volse-hubzilla-c36e0805d813121f0587c9f2d585fb32bfd346fa.tar.bz2 volse-hubzilla-c36e0805d813121f0587c9f2d585fb32bfd346fa.zip |
improve pconfig sync at the receiving side
-rw-r--r-- | Zotlabs/Lib/Libsync.php | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index ef10e8046..36a0a044c 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -230,8 +230,35 @@ class Libsync { if (array_key_exists('config', $arr) && is_array($arr['config']) && count($arr['config'])) { foreach ($arr['config'] as $cat => $k) { - foreach ($arr['config'][$cat] as $k => $v) - set_pconfig($channel['channel_id'], $cat, $k, $v); + $pconfig_updated = []; + + foreach($arr['config'][$cat] as $k => $v) { + if ($cat === 'hz_delpconfig' && strpos($k, 'b64.') === 0) { + $delpconfig = explode(':', unpack_link_id($k)); + + // delete the provided pconfig + del_pconfig($channel['channel_id'], $delpconfig[0], $delpconfig[1], $v); + + // delete the messenger pconfig + del_pconfig($channel['channel_id'], 'hz_delpconfig', $k); + } + + if (strpos($k,'pcfgud:') === 0) { + $realk = substr($k,7); + $pconfig_updated[$realk] = $v; + unset($arr['config'][$cat][$k]); + } + } + + foreach($arr['config'][$cat] as $k => $v) { + if (!isset($pconfig_updated[$k])) { + $pconfig_updated[$k] = NULL; + } + + if ($cat !== 'hz_delpconfig') { + set_pconfig($channel['channel_id'],$cat,$k,$v,$pconfig_updated[$k]); + } + } } } |