kalender und fixes
This commit is contained in:
1 parent
940d9bbde4
commit
416ca9e854
14 files changed
+376
-71
No files matched your search
@@ -190,7 +190,8 @@ class CalDavClient
|
||||
$block = $m[1];
|
||||
|
||||
$get = function ($prop) use ($block) {
|
||||
if (preg_match('/^' . preg_quote($prop, '/') . '[^:]*:(.+)$/m', $block, $m)) return trim($m[1]);
|
||||
// Match property value: everything after "PROP...:" until the next property or end
|
||||
if (preg_match('/^' . preg_quote($prop, '/') . '[^:]*:([\s\S]*?)(?=\n[A-Z][-A-Z]*[;:]|\z)/m', $block, $m)) return trim($m[1]);
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
+6
-4
@@ -171,7 +171,7 @@ class CalDavSync
|
||||
$location = '';
|
||||
if (preg_match('/\*\*Ort:\*\*\s*(.+)/i', $body, $lm)) $location = trim($lm[1]);
|
||||
$description = '';
|
||||
if (preg_match('/\*\*Notizen:\*\*\s*\n([\s\S]*?)(?:\n\n#|\z)/i', $body, $nm)) $description = trim($nm[1]);
|
||||
if (preg_match('/\*\*Notizen:\*\*\s*\n([\s\S]*?)(?=\n#[a-z]|\z)/i', $body, $nm)) $description = trim($nm[1]);
|
||||
|
||||
// Build DTSTART/DTEND
|
||||
$dateCompact = str_replace('-', '', $date);
|
||||
@@ -428,8 +428,11 @@ class CalDavSync
|
||||
if (isset($remoteMap[$uid])) {
|
||||
$remote = $remoteMap[$uid];
|
||||
$remoteClient = $this->makeClient($remote['cal_url']);
|
||||
$localChanged = !$card['caldav_synced_at'] || $card['updated_at'] > $card['caldav_synced_at'];
|
||||
$remoteChanged = $card['caldav_etag'] !== $remote['etag'];
|
||||
// Compare timestamps with 2s tolerance to avoid false positives from sync-triggered updates
|
||||
$localTime = strtotime($card['updated_at'] ?? '2000-01-01');
|
||||
$syncTime = strtotime($card['caldav_synced_at'] ?? '2000-01-01');
|
||||
$localChanged = !$card['caldav_synced_at'] || ($localTime - $syncTime) > 2;
|
||||
$remoteChanged = !$card['caldav_etag'] || $card['caldav_etag'] !== $remote['etag'];
|
||||
|
||||
// Always backfill rrule if missing locally but present remotely
|
||||
$remoteRRule = $remote['rrule'] ?? null;
|
||||
@@ -440,7 +443,6 @@ class CalDavSync
|
||||
}
|
||||
|
||||
if ($localChanged && $remoteChanged) {
|
||||
$localTime = strtotime($card['updated_at']);
|
||||
$remoteTime = $remote['last_modified'] ? strtotime($remote['last_modified']) : 0;
|
||||
if ($localTime >= $remoteTime) {
|
||||
$this->pushCard($remoteClient, $card, $remote['href'], $remote['etag']);
|
||||
|
||||
Reference in new issue
Block a user