From cdb9e81f693e56688bed50c0ec0253863be4080a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lehrke?= Date: Mon, 8 Feb 2010 19:50:56 +0000 Subject: [PATCH] Enable SlowSync optimization with old mappings; vCalendar 1.0 folding --- phpgwapi/inc/horde/Horde/SyncML/Command/Alert.php | 4 ++-- phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php | 6 ++++-- phpgwapi/inc/horde/Horde/iCalendar.php | 6 +++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command/Alert.php b/phpgwapi/inc/horde/Horde/SyncML/Command/Alert.php index fdf216b7e8..85670dc277 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command/Alert.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command/Alert.php @@ -285,10 +285,10 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command { $synctype != ALERT_ONE_WAY_FROM_CLIENT && $synctype != ALERT_ONE_WAY_FROM_SERVER) { $serverAnchorLast = 0; - #if (!$anchormatch) { + if (!$anchormatch) { // Erase existing map: $state->removeAllUID($this->_targetLocURI); - #} + } } // Now create the actual SyncML_Sync object, if it doesn't exist yet. $sync = &$state->getSync($this->_targetLocURI); diff --git a/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php b/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php index 59664cb881..e698c58c99 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php @@ -237,14 +237,16 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync { $guid = false; + $oguid = $state->getGlobalUID($type, $syncItem->getLocURI()); + $guid = $registry->call($hordeType . '/search', - array($state->convertClient2Server($syncItem->getContent(), $contentType), $contentType, $state->getGlobalUID($type, $syncItem->getLocURI()), $type)); + array($state->convertClient2Server($syncItem->getContent(), $contentType), $contentType, $oguid, $type)); if ($guid) { // Check if the found entry came from the client $guid_ts = $state->getSyncTSforAction($guid, 'add'); $sync_ts = $state->getChangeTS($type, $guid); - if ($sync_ts && $sync_ts == $guid_ts) { + if ($oguid != $guid && $sync_ts && $sync_ts == $guid_ts) { // Entry came from the client, so we get a duplicate here Horde::logMessage('SyncML: CONFLICT for locuri ' . $syncItem->getLocURI() . ' guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_WARNING); diff --git a/phpgwapi/inc/horde/Horde/iCalendar.php b/phpgwapi/inc/horde/Horde/iCalendar.php index bc81cf3b8a..80714c73d8 100644 --- a/phpgwapi/inc/horde/Horde/iCalendar.php +++ b/phpgwapi/inc/horde/Horde/iCalendar.php @@ -603,7 +603,11 @@ class Horde_iCalendar { // last=20line while (preg_match_all('/^([^:]+;\s*((ENCODING=)?QUOTED-PRINTABLE|ENCODING=[Q|q])(.*=\r?\n)+(.*[^=])?\r?\n)/mU', $vCal, $matches)) { foreach ($matches[1] as $s) { - $r = preg_replace('/=\r?\n[ \t]*/', '', $s); + if ($this->isOldFormat()) { + $r = preg_replace('/=\r?\n([ \t])/', '\1', $s); + } else { + $r = preg_replace('/=\r?\n[ \t]*/', '', $s); + } $vCal = str_replace($s, $r, $vCal); } }