From 4e42eb30f0bdf478df137e0ee45f1c9272af5003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lehrke?= Date: Fri, 25 Jun 2010 17:08:09 +0000 Subject: [PATCH] Enable Funambol client 8.5 again; various SyncML optimizations --- phpgwapi/inc/horde/Horde/RPC/syncml.php | 3 +- phpgwapi/inc/horde/Horde/SyncML.php | 50 ++++++- phpgwapi/inc/horde/Horde/SyncML/Command.php | 1 + .../inc/horde/Horde/SyncML/Command/Alert.php | 41 ------ .../inc/horde/Horde/SyncML/Command/Get.php | 59 ++++++-- .../horde/Horde/SyncML/Command/Replace.php | 2 +- .../inc/horde/Horde/SyncML/Command/Sync.php | 3 +- phpgwapi/inc/horde/Horde/SyncML/State.php | 128 ++++++++++-------- phpgwapi/inc/horde/Horde/SyncML/Sync.php | 22 ++- .../inc/horde/Horde/SyncML/Sync/SlowSync.php | 2 + phpgwapi/inc/horde/config/registry.php | 10 ++ 11 files changed, 206 insertions(+), 115 deletions(-) diff --git a/phpgwapi/inc/horde/Horde/RPC/syncml.php b/phpgwapi/inc/horde/Horde/RPC/syncml.php index 93350b03da..2920523bdc 100644 --- a/phpgwapi/inc/horde/Horde/RPC/syncml.php +++ b/phpgwapi/inc/horde/Horde/RPC/syncml.php @@ -92,7 +92,8 @@ class Horde_RPC_syncml extends Horde_RPC { $this->_output = new XML_WBXML_ContentHandler(); $this->_parse($request); - $response = $this->_output->getOutput(); + $response = '_charset . '"?>'; + $response .= $this->_output->getOutput(); /* Very useful for debugging. */ if (!empty($this->_debugDir) && is_dir($this->_debugDir)) { diff --git a/phpgwapi/inc/horde/Horde/SyncML.php b/phpgwapi/inc/horde/Horde/SyncML.php index fbabda2eec..6eed33fafc 100644 --- a/phpgwapi/inc/horde/Horde/SyncML.php +++ b/phpgwapi/inc/horde/Horde/SyncML.php @@ -569,7 +569,8 @@ class Horde_SyncML_SyncMLBody extends Horde_SyncML_ContentHandler { } $state->setAlert222Received(false); } - + + if ($state->needDeviceInfo()) $this->outputGetRequest(); // send the sync reply // we do still have some data to send OR @@ -700,5 +701,52 @@ class Horde_SyncML_SyncMLBody extends Horde_SyncML_ContentHandler { $this->_currentCommand->characters($str); } } + + function outputGetRequest() + { + $attrs = array(); + $state =& $_SESSION['SyncML.state']; + + $uri = $state->getURI(); + $uriMeta = $state->getURIMeta(); + + Horde::logMessage('SyncML: PreferedContentTypeClient missing, sending ', + __FILE__, __LINE__, PEAR_LOG_DEBUG); + + $this->_output->startElement($uri, 'Get', $attrs); + + $this->_output->startElement($uri, 'CmdID', $attrs); + $this->_output->characters($this->_currentCmdID); + $this->_currentCmdID++; + $this->_output->endElement($uri, 'CmdID'); + + $this->_output->startElement($uri, 'Meta', $attrs); + $this->_output->startElement($uriMeta, 'Type', $attrs); + if (is_a($this->_output, 'XML_WBXML_Encoder')) { + $this->_output->characters('application/vnd.syncml-devinf+wbxml'); + } else { + $this->_output->characters('application/vnd.syncml-devinf+xml'); + } + $this->_output->endElement($uriMeta, 'Type'); + $this->_output->endElement($uri, 'Meta'); + + $this->_output->startElement($uri, 'Item', $attrs); + $this->_output->startElement($uri, 'Target', $attrs); + $this->_output->startElement($uri, 'LocURI', $attrs); + if ($state->getVersion() == 2) { + $this->_output->characters('./devinf12'); + } elseif ($state->getVersion() == 1) { + $this->_output->characters('./devinf11'); + } else { + $this->_output->characters('./devinf10'); + } + $this->_output->endElement($uri, 'LocURI'); + $this->_output->endElement($uri, 'Target'); + $this->_output->endElement($uri, 'Item'); + + $this->_output->endElement($uri, 'Get'); + + $state->deviceInfoRequested(); + } } diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command.php b/phpgwapi/inc/horde/Horde/SyncML/Command.php index 505a32e12c..123d0e0fd3 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command.php @@ -153,6 +153,7 @@ class Horde_SyncML_Command { } if (class_exists($class)) { $cmd = new $class($params); + if (empty($cmd->_cmdName)) $cmd->_cmdName = $command; } else { $msg = 'SyncML: Class definition of ' . $class . ' not found.'; Horde::logMessage($msg, __FILE__, __LINE__, PEAR_LOG_ERR); diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command/Alert.php b/phpgwapi/inc/horde/Horde/SyncML/Command/Alert.php index 5785b00e0d..1327a66add 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command/Alert.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command/Alert.php @@ -401,47 +401,6 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command { $currentCmdID++; - if ($state->_devinfoRequested == false && - $this->_sourceLocURI != null && - is_a($state->getPreferedContentTypeClient($this->_sourceLocURI), 'PEAR_Error')) { - - Horde::logMessage("SyncML: PreferedContentTypeClient missing, sending ", __FILE__, __LINE__, PEAR_LOG_DEBUG); - - $output->startElement($state->getURI(), 'Get', $attrs); - - $output->startElement($state->getURI(), 'CmdID', $attrs); - $output->characters($currentCmdID); - $currentCmdID++; - $output->endElement($state->getURI(), 'CmdID'); - - $output->startElement($state->getURI(), 'Meta', $attrs); - $output->startElement($state->getURIMeta(), 'Type', $attrs); - if (is_a($output, 'XML_WBXML_Encoder')) { - $output->characters('application/vnd.syncml-devinf+wbxml'); - } else { - $output->characters('application/vnd.syncml-devinf+xml'); - } - $output->endElement($state->getURIMeta(), 'Type'); - $output->endElement($state->getURI(), 'Meta'); - - $output->startElement($state->getURI(), 'Item', $attrs); - $output->startElement($state->getURI(), 'Target', $attrs); - $output->startElement($state->getURI(), 'LocURI', $attrs); - if ($state->getVersion() == 2) { - $output->characters('./devinf12'); - } elseif ($state->getVersion() == 1) { - $output->characters('./devinf11'); - } else { - $output->characters('./devinf10'); - } - $output->endElement($state->getURI(), 'LocURI'); - $output->endElement($state->getURI(), 'Target'); - $output->endElement($state->getURI(), 'Item'); - - $output->endElement($state->getURI(), 'Get'); - - $state->_devinfoRequested = true; - } return $currentCmdID; } diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command/Get.php b/phpgwapi/inc/horde/Horde/SyncML/Command/Get.php index 2ffa10133b..49de9cdcdf 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command/Get.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command/Get.php @@ -20,6 +20,13 @@ include_once 'Horde/SyncML/Command.php'; include_once 'Horde/SyncML/Command/Results.php'; class Horde_SyncML_Command_Get extends Horde_SyncML_Command { + + /** + * Name of the command. + * + * @var string + */ + var $_cmdName = 'Get'; function output($currentCmdID, &$output) { @@ -33,7 +40,7 @@ class Horde_SyncML_Command_Get extends Horde_SyncML_Command { $ref = './devinf10'; } - $status = new Horde_SyncML_Command_Status((($state->isAuthorized()) ? RESPONSE_OK : RESPONSE_INVALID_CREDENTIALS), 'Get'); + $status = new Horde_SyncML_Command_Status((($state->isAuthorized()) ? RESPONSE_OK : RESPONSE_INVALID_CREDENTIALS), $this->_cmdName); $status->setCmdRef($this->_cmdID); $status->setTargetRef($ref); $currentCmdID = $status->output($currentCmdID, $output); @@ -80,16 +87,31 @@ class Horde_SyncML_Command_Get extends Horde_SyncML_Command { $output->startElement($state->getURIDevInf() , 'DevInf', $attrs); $output->startElement($state->getURIDevInf() , 'VerDTD', $attrs); if ($state->getVersion() == 2) { - $output->characters('1.2'); + $output->characters('1.2'); } elseif($state->getVersion() == 1) { - $output->characters('1.1'); + $output->characters('1.1'); } else { - $output->characters('1.0'); + $output->characters('1.0'); } $output->endElement($state->getURIDevInf() , 'VerDTD', $attrs); $output->startElement($state->getURIDevInf() , 'Man', $attrs); $output->characters('www.egroupware.org'); $output->endElement($state->getURIDevInf() , 'Man', $attrs); + $output->startElement($state->getURIDevInf() , 'Mod', $attrs); + $output->characters('DS Server'); + $output->endElement($state->getURIDevInf() , 'Mod', $attrs); + $output->startElement($state->getURIDevInf() , 'OEM', $attrs); + $output->characters('-'); + $output->endElement($state->getURIDevInf() , 'OEM', $attrs); + $output->startElement($state->getURIDevInf() , 'FwV', $attrs); + $output->characters('-'); + $output->endElement($state->getURIDevInf() , 'FwV', $attrs); + $output->startElement($state->getURIDevInf() , 'SwV', $attrs); + $output->characters('1.7.x'); + $output->endElement($state->getURIDevInf() , 'SwV', $attrs); + $output->startElement($state->getURIDevInf() , 'HwV', $attrs); + $output->characters('-'); + $output->endElement($state->getURIDevInf() , 'HwV', $attrs); $output->startElement($state->getURIDevInf() , 'DevID', $attrs); $output->characters($_SERVER['HTTP_HOST']); $output->endElement($state->getURIDevInf() , 'DevID', $attrs); @@ -102,28 +124,36 @@ class Horde_SyncML_Command_Get extends Horde_SyncML_Command { $output->endElement($state->getURIDevInf() , 'SupportNumberOfChanges', $attrs); $output->startElement($state->getURIDevInf() , 'SupportLargeObjs', $attrs); $output->endElement($state->getURIDevInf() , 'SupportLargeObjs', $attrs); - $this->_writeDataStore('./notes', 'text/x-vnote', '1.1', $output, + $this->_writeDataStore('notes', 'text/x-vnote', '1.1', $output, array('text/plain' => '1.0')); - $this->_writeDataStore('./contacts', 'text/vcard', '3.0', $output, + $this->_writeDataStore('contacts', 'text/vcard', '3.0', $output, array('text/x-vcard' => '2.1')); - $this->_writeDataStore('./card', 'text/vcard', '3.0', $output, + $this->_writeDataStore('card', 'text/vcard', '3.0', $output, array('text/x-vcard' => '2.1')); - $this->_writeDataStore('./tasks', 'text/calendar', '2.0', $output, + $this->_writeDataStore('tasks', 'text/calendar', '2.0', $output, array('text/x-vcalendar' => '1.0')); - $this->_writeDataStore('./jobs', 'text/calendar', '2.0', $output, + $this->_writeDataStore('jobs', 'text/calendar', '2.0', $output, array('text/x-vcalendar' => '1.0')); - $this->_writeDataStore('./calendar', 'text/calendar', '2.0', $output, + $this->_writeDataStore('calendar', 'text/calendar', '2.0', $output, array('text/x-vcalendar' => '1.0')); - $this->_writeDataStore('./events', 'text/calendar', '2.0', $output, + $this->_writeDataStore('events', 'text/calendar', '2.0', $output, array('text/x-vcalendar' => '1.0')); - $this->_writeDataStore('./caltasks', 'text/calendar', '2.0', $output, + $this->_writeDataStore('caltasks', 'text/calendar', '2.0', $output, array('text/x-vcalendar' => '1.0')); + // Funambol special Datastore + $this->_writeDataStore('configuration', 'text/plain', '1.0', $output); $output->endElement($state->getURIDevInf() , 'DevInf', $attrs); $output->endElement($state->getURI(), 'Data'); $output->endElement($state->getURI(), 'Item'); $output->endElement($state->getURI(), 'Results'); - + /* + $output->startElement($state->getURIDevInf() , 'Ext', $attrs); + $output->startElement($state->getURIDevInf() , 'XNam', $attrs); + $output->characters('X-funambol-smartslow'); + $output->endElement($state->getURIDevInf() , 'XNam', $attrs); + $output->endElement($state->getURIDevInf() , 'Ext', $attrs); + */ $currentCmdID++; } @@ -151,6 +181,9 @@ class Horde_SyncML_Command_Get extends Horde_SyncML_Command { $output->startElement($state->getURIDevInf() , 'SourceRef', $attrs); $output->characters($sourceref); $output->endElement($state->getURIDevInf() , 'SourceRef', $attrs); + $output->startElement($state->getURIDevInf() , 'DisplayName', $attrs); + $output->characters($sourceref); + $output->endElement($state->getURIDevInf() , 'DisplayName', $attrs); $output->startElement($state->getURIDevInf() , 'MaxGUIDSize', $attrs); $output->characters(255); $output->endElement($state->getURIDevInf() , 'MaxGUIDSize', $attrs); diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command/Replace.php b/phpgwapi/inc/horde/Horde/SyncML/Command/Replace.php index 010083bbf2..19f0751c01 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command/Replace.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command/Replace.php @@ -15,7 +15,7 @@ */ include_once 'Horde/SyncML/Command.php'; -class Horde_SyncML_Command_Final extends Horde_SyncML_Command { +class Horde_SyncML_Command_Replace extends Horde_SyncML_Command { /** * Name of the command. diff --git a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync.php b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync.php index 9e4704df22..d65944a47b 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Command/Sync.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Command/Sync.php @@ -88,8 +88,7 @@ class Horde_SyncML_Command_Sync extends Horde_SyncML_Command { $currentCmdID = $status->output($currentCmdID, $output); - if ($this->_targetURI != "configuration" && // Fix Funambol issue - ($sync = &$state->getSync($this->_targetURI))) { + if (($sync = &$state->getSync($this->_targetURI))) { $currentCmdID = $sync->startSync($currentCmdID, $output); foreach ($this->_syncElements as $element) { diff --git a/phpgwapi/inc/horde/Horde/SyncML/State.php b/phpgwapi/inc/horde/Horde/SyncML/State.php index a088667917..3635cab7cb 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/State.php +++ b/phpgwapi/inc/horde/Horde/SyncML/State.php @@ -69,7 +69,7 @@ define('RESPONSE_NO_CONTENT', 204); define('RESPONSE_RESET_CONTENT', 205); define('RESPONSE_PARTIAL_CONTENT', 206); define('RESPONSE_CONFLICT_RESOLVED_WITH_MERGE', 207); -define('RESPONSE_CONFLICT_RESOLVED_WITH_CLIENT_WINNING', 208); +define('RESPONSE_CONFLICT_RESOLVED_WITH_CLIENT_WINS', 208); define('RESPONSE_CONFILCT_RESOLVED_WITH_DUPLICATE', 209); define('RESPONSE_DELETE_WITHOUT_ARCHIVE', 210); define('RESPONSE_ITEM_NO_DELETED', 211); @@ -80,60 +80,60 @@ define('RESPONSE_NO_EXECUTED', 215); define('RESPONSE_ATOMIC_ROLL_BACK_OK', 216); define('RESPONSE_MULTIPLE_CHOICES', 300); -// Need to change names. -// define('RESPONSE_MULTIPLE_CHOICES', 301); -// define('RESPONSE_MULTIPLE_CHOICES', 302); -// define('RESPONSE_MULTIPLE_CHOICES', 303); -// define('RESPONSE_MULTIPLE_CHOICES', 304); +define('RESPONSE_MOVED_PERMANENTLY', 301); +define('RESPONSE_FOUND', 302); +define('RESPONSE_SEE_OTHER', 303); +define('RESPONSE_NOT_MODIFIED', 304); define('RESPONSE_USE_PROXY', 305); define('RESPONSE_BAD_REQUEST', 400); define('RESPONSE_INVALID_CREDENTIALS', 401); -// Need to change names. -// define('RESPONSE_INVALID_CREDENTIALS', 402); -// define('RESPONSE_INVALID_CREDENTIALS', 403); +define('RESPONSE_PAYMENT_NEEDED', 402); +define('RESPONSE_FORBIDDEN', 403); define('RESPONSE_NOT_FOUND', 404); -// Need to change names. -// define('RESPONSE_INVALID_CREDENTIALS', 405); -// define('RESPONSE_INVALID_CREDENTIALS', 406); +define('RESPONSE_COMMAND_DENIED', 405); +define('RESPONSE_FEATURE_NOT_SUPPORTED', 406); define('RESPONSE_MISSING_CREDENTIALS', 407); -// define('RESPONSE_INVALID_CREDENTIALS', 408); -// define('RESPONSE_INVALID_CREDENTIALS', 409); -// define('RESPONSE_INVALID_CREDENTIALS', 410); -// define('RESPONSE_INVALID_CREDENTIALS', 411); -// define('RESPONSE_INVALID_CREDENTIALS', 412); -// define('RESPONSE_INVALID_CREDENTIALS', 413); -// define('RESPONSE_INVALID_CREDENTIALS', 414); -// define('RESPONSE_INVALID_CREDENTIALS', 415); +define('RESPONSE_REQUEST_TIMEOUT', 408); +define('RESPONSE_CONFLICT_DETECTED', 409); +define('RESPONSE_ITEM_GONE', 410); +define('RESPONSE_SIZE_REQUIRED', 411); +define('RESPONSE_INCOMPLETE_COMMAND', 412); +define('RESPONSE_ENTITY_TO_LARGE', 413); +define('RESPONSE_URI_TOO_LONG', 414); +define('RESPONSE_UNSUPPORTED_MEDIA_TYPE', 415); define('RESPONSE_REQUEST_SIZE_TOO_BIG', 416); -// Need to change names. -// define('RESPONSE_INVALID_CREDENTIALS', 417); -// define('RESPONSE_INVALID_CREDENTIALS', 418); -// define('RESPONSE_INVALID_CREDENTIALS', 419); -// define('RESPONSE_INVALID_CREDENTIALS', 420); -// define('RESPONSE_INVALID_CREDENTIALS', 421); -// define('RESPONSE_INVALID_CREDENTIALS', 422); -// define('RESPONSE_INVALID_CREDENTIALS', 423); +define('RESPONSE_RETRY_LATER', 417); +define('RESPONSE_ALREADY_EXISITS', 418); +define('RESPONSE_CONFLICT_RESOLVED_WITH_SERVER_WINS', 419); +define('RESPONSE_DEVICE_FULL', 420); +define('RESPONSE_UNKNOWN_SEARCH_GRAMMAR', 421); +define('RESPONSE_BAD_CGI', 422); +define('RESPONSE_SOFT_DELETE_CONFICT', 423); define('RESPONSE_SIZE_MISMATCH', 424); +define('RESPONSE_PERMISSION_DENIED', 425); +define('RESPONSE_PARTIAL_ITEM_NOT_ACCEPTED', 426); +define('RESPONSE_ITEM_NOT_EMPTY', 427); +define('RESPONSE_MOVE_FAILED', 428); define('RESPONSE_COMMAND_FAILED', 500); -// Need to change names. -// define('RESPONSE_COMMAND_FAILED', 501); -// define('RESPONSE_COMMAND_FAILED', 502); -// define('RESPONSE_COMMAND_FAILED', 503); -// define('RESPONSE_COMMAND_FAILED', 504); -// define('RESPONSE_COMMAND_FAILED', 505); -// define('RESPONSE_COMMAND_FAILED', 506); -// define('RESPONSE_COMMAND_FAILED', 507); +define('RESPONSE_COMMAND_NOT_IMPLEMENTED', 501); +define('RESPONSE_BAD_GATEWAY', 502); +define('RESPONSE_SERVICE_UNAVAILABLE', 503); +define('RESPONSE_GATEWAY_TIMEOUT', 504); +define('RESPONSE_DTD_VERSION_NOT_SUPPORTED', 505); +define('RESPONSE_PROCESSING_ERROR', 506); +define('RESPONSE_ATOMIC_FAILED', 507); define('RESPONSE_REFRESH_REQUIRED', 508); -// define('RESPONSE_COMMAND_FAILED', 509); -// define('RESPONSE_COMMAND_FAILED', 510); -// define('RESPONSE_COMMAND_FAILED', 511); -// define('RESPONSE_COMMAND_FAILED', 512); -// define('RESPONSE_COMMAND_FAILED', 513); -// define('RESPONSE_COMMAND_FAILED', 514); -// define('RESPONSE_COMMAND_FAILED', 515); +// define('RESPONSE_FUTURE_USE', 509); +define('RESPONSE_DATASTORE_FAILURE', 510); +define('RESPONSE_SERVER_FAILURE', 511); +define('RESPONSE_SYNCHRONIZATION_FAILED', 512); +define('RESPONSE_PROTOCOL_VERSION_NOT_SUPPORTED', 513); +define('RESPONSE_OPERATION_CANCELLED', 514); +define('RESPONSE_COMMAND_FAILED', 515); define('RESPONSE_ATOMIC_ROLL_BACK_FAILED', 516); +define('RESPONSE_ATOMIC_RESPONSE_TOO_LARGE', 517); define('NAME_SPACE_URI_SYNCML_1_0', 'syncml:syncml1.0'); define('NAME_SPACE_URI_SYNCML_1_1', 'syncml:syncml1.1'); @@ -629,6 +629,29 @@ class Horde_SyncML_State { return $targets; } + + function needDeviceInfo() + { + if ($this->_devinfoRequested || count($this->_syncs) < 1) return false; + + $sendGetRequest = false; + + foreach($this->_syncs as $sync) + { + if (($source = $sync->getSourceLocURI()) && + is_a($this->getPreferedContentTypeClient($source), 'PEAR_Error')) { + $sendGetRequest = true; + break; + } + } + + return $sendGetRequest; + } + + function deviceInfoRequested() + { + $this->_devinfoRequested = true; + } function getURI() { @@ -912,53 +935,45 @@ class Horde_SyncML_State { case 'contacts': case 'card': return 'contacts'; - break; case 'notes': return 'notes'; - break; case 'tasks': case 'jobs': return 'tasks'; - break; case 'events': case 'calendar': return 'calendar'; - break; case 'caltasks': return 'caltasks'; - break; # funambol related types - case 'sifcalendar': case 'scal': return 'sifcalendar'; - break; case 'sifcontacts': case 'scard': return 'sifcontacts'; - break; case 'siftasks': case 'stask': return 'siftasks'; - break; case 'sifnotes': case 'snote': return 'sifnotes'; - break; + + case 'configuration': + return 'configuration'; default: Horde::logMessage("SyncML: unknown hordeType for type=$type ($_type)", __FILE__, __LINE__, PEAR_LOG_INFO); - return $_type; - break; } + return $_type; } /** @@ -993,6 +1008,9 @@ class Horde_SyncML_State { 'mayFragment' => 1, 'Properties' => $cprops, ); + + if ($_targetLocURI == 'configuration') $clientPrefs['ContentFormat'] = 'b64'; + #Horde::logMessage('SyncML: sourceLocURI ' . $_sourceLocURI . " clientPrefs:\n" # . print_r($clientPrefs, true), __FILE__, __LINE__, PEAR_LOG_DEBUG); return $this->adjustContentType($clientPrefs, $_targetLocURI); diff --git a/phpgwapi/inc/horde/Horde/SyncML/Sync.php b/phpgwapi/inc/horde/Horde/SyncML/Sync.php index b826742bef..1fff5eaa90 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Sync.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Sync.php @@ -114,6 +114,18 @@ class Horde_SyncML_Sync { function setSourceLocURI($sourceURI) { $this->_sourceLocURI = $sourceURI; } + + /** + * Get sourceURI. + * + * @return string $sourceURI or false on error. + */ + function getSourceLocURI() { + if (empty($this->_sourceLocURI)) { + return false; + } + return $this->_sourceLocURI; + } /** * Setter for property targetURI. @@ -308,6 +320,10 @@ class Horde_SyncML_Sync { $replace = true; $ok = false; $merge = false; + if ($hordeType == 'configuration') + { + $command->setStatus(RESPONSE_ALREADY_EXISITS); + } if ($guid) { Horde::logMessage('SyncML: locuri '. $locURI . ' guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_DEBUG); @@ -317,12 +333,13 @@ class Horde_SyncML_Sync { switch ($sync_conflicts) { case CONFLICT_CLIENT_WINNING: - $command->setStatus(RESPONSE_CONFLICT_RESOLVED_WITH_CLIENT_WINNING); + $command->setStatus(RESPONSE_CONFLICT_RESOLVED_WITH_CLIENT_WINS); break; case CONFLICT_SERVER_WINNING: Horde::logMessage('SyncML: REJECT client change for locuri ' . $locURI . ' guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_WARNING); + $command->setStatus(RESPONSE_CONFLICT_RESOLVED_WITH_SERVER_WINS); $ok = true; $replace = false; $state->log('Client-AddReplaceIgnored'); @@ -331,6 +348,7 @@ class Horde_SyncML_Sync { Horde::logMessage('SyncML: Merge server and client data for locuri ' . $locURI . ' guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_WARNING); + $command->setStatus(RESPONSE_CONFLICT_RESOLVED_WITH_MERGE); $merge = true; break; case CONFLICT_RESOLVED_WITH_DUPLICATE: @@ -340,6 +358,7 @@ class Horde_SyncML_Sync { Horde::logMessage('SyncML: Server RO! REJECT client change for locuri ' . $locURI . ' guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_WARNING); + $command->setStatus(RESPONSE_PERMISSION_DENIED); $ok = true; $replace = false; $ts = $state->getSyncTSforAction($guid, 'modify'); @@ -350,6 +369,7 @@ class Horde_SyncML_Sync { Horde::logMessage('SyncML: Server RO! UNDO client change for locuri ' . $locURI . ' guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_WARNING); + $command->setStatus(RESPONSE_PERMISSION_DENIED); $state->pushChangedItem($type, $guid); $ok = true; $replace = false; diff --git a/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php b/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php index 143aae2639..4f7ecb0749 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php +++ b/phpgwapi/inc/horde/Horde/SyncML/Sync/SlowSync.php @@ -244,6 +244,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync { . ' guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_WARNING); if ($sync_conflicts != CONFLICT_RESOLVED_WITH_DUPLICATE) { $state->log("Client-AddReplaceIgnored"); + $command->setStatus(RESPONSE_CONFILCT_RESOLVED_WITH_DUPLICATE); continue; } } else { @@ -252,6 +253,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync { __FILE__, __LINE__, PEAR_LOG_DEBUG); $state->setUID($type, $locURI, $guid); $state->log("Client-Map"); + $command->setStatus(RESPONSE_ALREADY_EXISITS); continue; } } diff --git a/phpgwapi/inc/horde/config/registry.php b/phpgwapi/inc/horde/config/registry.php index d6f93773f3..fba8f4b48e 100644 --- a/phpgwapi/inc/horde/config/registry.php +++ b/phpgwapi/inc/horde/config/registry.php @@ -151,3 +151,13 @@ $this->applications['egwcaltaskssync'] = array( 'menu_parent' => 'organizing' ); +$this->applications['egwconfigurationsync'] = array( + 'fileroot' => EGW_SERVER_ROOT.'/syncml/configuration', + 'webroot' => $this->applications['horde']['webroot'] . '/mnemo', + 'icon' => $this->applications['horde']['webroot'] . '/mnemo/graphics/mnemo.gif', + 'name' => _("Funambol Configurations"), + 'status' => 'active', + 'provides' => array('configuration'), + 'menu_parent' => 'organizing' +); +