Enable Funambol client 8.5 again; various SyncML optimizations

This commit is contained in:
Jörg Lehrke 2010-06-25 17:08:09 +00:00
parent 435e282efa
commit 4e42eb30f0
11 changed files with 206 additions and 115 deletions

View File

@ -92,7 +92,8 @@ class Horde_RPC_syncml extends Horde_RPC {
$this->_output = new XML_WBXML_ContentHandler(); $this->_output = new XML_WBXML_ContentHandler();
$this->_parse($request); $this->_parse($request);
$response = $this->_output->getOutput(); $response = '<?xml version="1.0" encoding="' . $this->_charset . '"?>';
$response .= $this->_output->getOutput();
/* Very useful for debugging. */ /* Very useful for debugging. */
if (!empty($this->_debugDir) && is_dir($this->_debugDir)) { if (!empty($this->_debugDir) && is_dir($this->_debugDir)) {

View File

@ -569,7 +569,8 @@ class Horde_SyncML_SyncMLBody extends Horde_SyncML_ContentHandler {
} }
$state->setAlert222Received(false); $state->setAlert222Received(false);
} }
if ($state->needDeviceInfo()) $this->outputGetRequest();
// send the sync reply // send the sync reply
// we do still have some data to send OR // 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); $this->_currentCommand->characters($str);
} }
} }
function outputGetRequest()
{
$attrs = array();
$state =& $_SESSION['SyncML.state'];
$uri = $state->getURI();
$uriMeta = $state->getURIMeta();
Horde::logMessage('SyncML: PreferedContentTypeClient missing, sending <Get>',
__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();
}
} }

View File

@ -153,6 +153,7 @@ class Horde_SyncML_Command {
} }
if (class_exists($class)) { if (class_exists($class)) {
$cmd = new $class($params); $cmd = new $class($params);
if (empty($cmd->_cmdName)) $cmd->_cmdName = $command;
} else { } else {
$msg = 'SyncML: Class definition of ' . $class . ' not found.'; $msg = 'SyncML: Class definition of ' . $class . ' not found.';
Horde::logMessage($msg, __FILE__, __LINE__, PEAR_LOG_ERR); Horde::logMessage($msg, __FILE__, __LINE__, PEAR_LOG_ERR);

View File

@ -401,47 +401,6 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command {
$currentCmdID++; $currentCmdID++;
if ($state->_devinfoRequested == false &&
$this->_sourceLocURI != null &&
is_a($state->getPreferedContentTypeClient($this->_sourceLocURI), 'PEAR_Error')) {
Horde::logMessage("SyncML: PreferedContentTypeClient missing, sending <Get>", __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; return $currentCmdID;
} }

View File

@ -20,6 +20,13 @@ include_once 'Horde/SyncML/Command.php';
include_once 'Horde/SyncML/Command/Results.php'; include_once 'Horde/SyncML/Command/Results.php';
class Horde_SyncML_Command_Get extends Horde_SyncML_Command { class Horde_SyncML_Command_Get extends Horde_SyncML_Command {
/**
* Name of the command.
*
* @var string
*/
var $_cmdName = 'Get';
function output($currentCmdID, &$output) function output($currentCmdID, &$output)
{ {
@ -33,7 +40,7 @@ class Horde_SyncML_Command_Get extends Horde_SyncML_Command {
$ref = './devinf10'; $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->setCmdRef($this->_cmdID);
$status->setTargetRef($ref); $status->setTargetRef($ref);
$currentCmdID = $status->output($currentCmdID, $output); $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() , 'DevInf', $attrs);
$output->startElement($state->getURIDevInf() , 'VerDTD', $attrs); $output->startElement($state->getURIDevInf() , 'VerDTD', $attrs);
if ($state->getVersion() == 2) { if ($state->getVersion() == 2) {
$output->characters('1.2'); $output->characters('1.2');
} elseif($state->getVersion() == 1) { } elseif($state->getVersion() == 1) {
$output->characters('1.1'); $output->characters('1.1');
} else { } else {
$output->characters('1.0'); $output->characters('1.0');
} }
$output->endElement($state->getURIDevInf() , 'VerDTD', $attrs); $output->endElement($state->getURIDevInf() , 'VerDTD', $attrs);
$output->startElement($state->getURIDevInf() , 'Man', $attrs); $output->startElement($state->getURIDevInf() , 'Man', $attrs);
$output->characters('www.egroupware.org'); $output->characters('www.egroupware.org');
$output->endElement($state->getURIDevInf() , 'Man', $attrs); $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->startElement($state->getURIDevInf() , 'DevID', $attrs);
$output->characters($_SERVER['HTTP_HOST']); $output->characters($_SERVER['HTTP_HOST']);
$output->endElement($state->getURIDevInf() , 'DevID', $attrs); $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->endElement($state->getURIDevInf() , 'SupportNumberOfChanges', $attrs);
$output->startElement($state->getURIDevInf() , 'SupportLargeObjs', $attrs); $output->startElement($state->getURIDevInf() , 'SupportLargeObjs', $attrs);
$output->endElement($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')); 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')); 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')); 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')); 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')); 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')); 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')); 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')); 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->getURIDevInf() , 'DevInf', $attrs);
$output->endElement($state->getURI(), 'Data'); $output->endElement($state->getURI(), 'Data');
$output->endElement($state->getURI(), 'Item'); $output->endElement($state->getURI(), 'Item');
$output->endElement($state->getURI(), 'Results'); $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++; $currentCmdID++;
} }
@ -151,6 +181,9 @@ class Horde_SyncML_Command_Get extends Horde_SyncML_Command {
$output->startElement($state->getURIDevInf() , 'SourceRef', $attrs); $output->startElement($state->getURIDevInf() , 'SourceRef', $attrs);
$output->characters($sourceref); $output->characters($sourceref);
$output->endElement($state->getURIDevInf() , 'SourceRef', $attrs); $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->startElement($state->getURIDevInf() , 'MaxGUIDSize', $attrs);
$output->characters(255); $output->characters(255);
$output->endElement($state->getURIDevInf() , 'MaxGUIDSize', $attrs); $output->endElement($state->getURIDevInf() , 'MaxGUIDSize', $attrs);

View File

@ -15,7 +15,7 @@
*/ */
include_once 'Horde/SyncML/Command.php'; 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. * Name of the command.

View File

@ -88,8 +88,7 @@ class Horde_SyncML_Command_Sync extends Horde_SyncML_Command {
$currentCmdID = $status->output($currentCmdID, $output); $currentCmdID = $status->output($currentCmdID, $output);
if ($this->_targetURI != "configuration" && // Fix Funambol issue if (($sync = &$state->getSync($this->_targetURI))) {
($sync = &$state->getSync($this->_targetURI))) {
$currentCmdID = $sync->startSync($currentCmdID, $output); $currentCmdID = $sync->startSync($currentCmdID, $output);
foreach ($this->_syncElements as $element) { foreach ($this->_syncElements as $element) {

View File

@ -69,7 +69,7 @@ define('RESPONSE_NO_CONTENT', 204);
define('RESPONSE_RESET_CONTENT', 205); define('RESPONSE_RESET_CONTENT', 205);
define('RESPONSE_PARTIAL_CONTENT', 206); define('RESPONSE_PARTIAL_CONTENT', 206);
define('RESPONSE_CONFLICT_RESOLVED_WITH_MERGE', 207); 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_CONFILCT_RESOLVED_WITH_DUPLICATE', 209);
define('RESPONSE_DELETE_WITHOUT_ARCHIVE', 210); define('RESPONSE_DELETE_WITHOUT_ARCHIVE', 210);
define('RESPONSE_ITEM_NO_DELETED', 211); define('RESPONSE_ITEM_NO_DELETED', 211);
@ -80,60 +80,60 @@ define('RESPONSE_NO_EXECUTED', 215);
define('RESPONSE_ATOMIC_ROLL_BACK_OK', 216); define('RESPONSE_ATOMIC_ROLL_BACK_OK', 216);
define('RESPONSE_MULTIPLE_CHOICES', 300); define('RESPONSE_MULTIPLE_CHOICES', 300);
// Need to change names. define('RESPONSE_MOVED_PERMANENTLY', 301);
// define('RESPONSE_MULTIPLE_CHOICES', 301); define('RESPONSE_FOUND', 302);
// define('RESPONSE_MULTIPLE_CHOICES', 302); define('RESPONSE_SEE_OTHER', 303);
// define('RESPONSE_MULTIPLE_CHOICES', 303); define('RESPONSE_NOT_MODIFIED', 304);
// define('RESPONSE_MULTIPLE_CHOICES', 304);
define('RESPONSE_USE_PROXY', 305); define('RESPONSE_USE_PROXY', 305);
define('RESPONSE_BAD_REQUEST', 400); define('RESPONSE_BAD_REQUEST', 400);
define('RESPONSE_INVALID_CREDENTIALS', 401); define('RESPONSE_INVALID_CREDENTIALS', 401);
// Need to change names. define('RESPONSE_PAYMENT_NEEDED', 402);
// define('RESPONSE_INVALID_CREDENTIALS', 402); define('RESPONSE_FORBIDDEN', 403);
// define('RESPONSE_INVALID_CREDENTIALS', 403);
define('RESPONSE_NOT_FOUND', 404); define('RESPONSE_NOT_FOUND', 404);
// Need to change names. define('RESPONSE_COMMAND_DENIED', 405);
// define('RESPONSE_INVALID_CREDENTIALS', 405); define('RESPONSE_FEATURE_NOT_SUPPORTED', 406);
// define('RESPONSE_INVALID_CREDENTIALS', 406);
define('RESPONSE_MISSING_CREDENTIALS', 407); define('RESPONSE_MISSING_CREDENTIALS', 407);
// define('RESPONSE_INVALID_CREDENTIALS', 408); define('RESPONSE_REQUEST_TIMEOUT', 408);
// define('RESPONSE_INVALID_CREDENTIALS', 409); define('RESPONSE_CONFLICT_DETECTED', 409);
// define('RESPONSE_INVALID_CREDENTIALS', 410); define('RESPONSE_ITEM_GONE', 410);
// define('RESPONSE_INVALID_CREDENTIALS', 411); define('RESPONSE_SIZE_REQUIRED', 411);
// define('RESPONSE_INVALID_CREDENTIALS', 412); define('RESPONSE_INCOMPLETE_COMMAND', 412);
// define('RESPONSE_INVALID_CREDENTIALS', 413); define('RESPONSE_ENTITY_TO_LARGE', 413);
// define('RESPONSE_INVALID_CREDENTIALS', 414); define('RESPONSE_URI_TOO_LONG', 414);
// define('RESPONSE_INVALID_CREDENTIALS', 415); define('RESPONSE_UNSUPPORTED_MEDIA_TYPE', 415);
define('RESPONSE_REQUEST_SIZE_TOO_BIG', 416); define('RESPONSE_REQUEST_SIZE_TOO_BIG', 416);
// Need to change names. define('RESPONSE_RETRY_LATER', 417);
// define('RESPONSE_INVALID_CREDENTIALS', 417); define('RESPONSE_ALREADY_EXISITS', 418);
// define('RESPONSE_INVALID_CREDENTIALS', 418); define('RESPONSE_CONFLICT_RESOLVED_WITH_SERVER_WINS', 419);
// define('RESPONSE_INVALID_CREDENTIALS', 419); define('RESPONSE_DEVICE_FULL', 420);
// define('RESPONSE_INVALID_CREDENTIALS', 420); define('RESPONSE_UNKNOWN_SEARCH_GRAMMAR', 421);
// define('RESPONSE_INVALID_CREDENTIALS', 421); define('RESPONSE_BAD_CGI', 422);
// define('RESPONSE_INVALID_CREDENTIALS', 422); define('RESPONSE_SOFT_DELETE_CONFICT', 423);
// define('RESPONSE_INVALID_CREDENTIALS', 423);
define('RESPONSE_SIZE_MISMATCH', 424); 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); define('RESPONSE_COMMAND_FAILED', 500);
// Need to change names. define('RESPONSE_COMMAND_NOT_IMPLEMENTED', 501);
// define('RESPONSE_COMMAND_FAILED', 501); define('RESPONSE_BAD_GATEWAY', 502);
// define('RESPONSE_COMMAND_FAILED', 502); define('RESPONSE_SERVICE_UNAVAILABLE', 503);
// define('RESPONSE_COMMAND_FAILED', 503); define('RESPONSE_GATEWAY_TIMEOUT', 504);
// define('RESPONSE_COMMAND_FAILED', 504); define('RESPONSE_DTD_VERSION_NOT_SUPPORTED', 505);
// define('RESPONSE_COMMAND_FAILED', 505); define('RESPONSE_PROCESSING_ERROR', 506);
// define('RESPONSE_COMMAND_FAILED', 506); define('RESPONSE_ATOMIC_FAILED', 507);
// define('RESPONSE_COMMAND_FAILED', 507);
define('RESPONSE_REFRESH_REQUIRED', 508); define('RESPONSE_REFRESH_REQUIRED', 508);
// define('RESPONSE_COMMAND_FAILED', 509); // define('RESPONSE_FUTURE_USE', 509);
// define('RESPONSE_COMMAND_FAILED', 510); define('RESPONSE_DATASTORE_FAILURE', 510);
// define('RESPONSE_COMMAND_FAILED', 511); define('RESPONSE_SERVER_FAILURE', 511);
// define('RESPONSE_COMMAND_FAILED', 512); define('RESPONSE_SYNCHRONIZATION_FAILED', 512);
// define('RESPONSE_COMMAND_FAILED', 513); define('RESPONSE_PROTOCOL_VERSION_NOT_SUPPORTED', 513);
// define('RESPONSE_COMMAND_FAILED', 514); define('RESPONSE_OPERATION_CANCELLED', 514);
// define('RESPONSE_COMMAND_FAILED', 515); define('RESPONSE_COMMAND_FAILED', 515);
define('RESPONSE_ATOMIC_ROLL_BACK_FAILED', 516); 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_0', 'syncml:syncml1.0');
define('NAME_SPACE_URI_SYNCML_1_1', 'syncml:syncml1.1'); define('NAME_SPACE_URI_SYNCML_1_1', 'syncml:syncml1.1');
@ -629,6 +629,29 @@ class Horde_SyncML_State {
return $targets; 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() function getURI()
{ {
@ -912,53 +935,45 @@ class Horde_SyncML_State {
case 'contacts': case 'contacts':
case 'card': case 'card':
return 'contacts'; return 'contacts';
break;
case 'notes': case 'notes':
return 'notes'; return 'notes';
break;
case 'tasks': case 'tasks':
case 'jobs': case 'jobs':
return 'tasks'; return 'tasks';
break;
case 'events': case 'events':
case 'calendar': case 'calendar':
return 'calendar'; return 'calendar';
break;
case 'caltasks': case 'caltasks':
return 'caltasks'; return 'caltasks';
break;
# funambol related types # funambol related types
case 'sifcalendar': case 'sifcalendar':
case 'scal': case 'scal':
return 'sifcalendar'; return 'sifcalendar';
break;
case 'sifcontacts': case 'sifcontacts':
case 'scard': case 'scard':
return 'sifcontacts'; return 'sifcontacts';
break;
case 'siftasks': case 'siftasks':
case 'stask': case 'stask':
return 'siftasks'; return 'siftasks';
break;
case 'sifnotes': case 'sifnotes':
case 'snote': case 'snote':
return 'sifnotes'; return 'sifnotes';
break;
case 'configuration':
return 'configuration';
default: default:
Horde::logMessage("SyncML: unknown hordeType for type=$type ($_type)", __FILE__, __LINE__, PEAR_LOG_INFO); 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, 'mayFragment' => 1,
'Properties' => $cprops, 'Properties' => $cprops,
); );
if ($_targetLocURI == 'configuration') $clientPrefs['ContentFormat'] = 'b64';
#Horde::logMessage('SyncML: sourceLocURI ' . $_sourceLocURI . " clientPrefs:\n" #Horde::logMessage('SyncML: sourceLocURI ' . $_sourceLocURI . " clientPrefs:\n"
# . print_r($clientPrefs, true), __FILE__, __LINE__, PEAR_LOG_DEBUG); # . print_r($clientPrefs, true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
return $this->adjustContentType($clientPrefs, $_targetLocURI); return $this->adjustContentType($clientPrefs, $_targetLocURI);

View File

@ -114,6 +114,18 @@ class Horde_SyncML_Sync {
function setSourceLocURI($sourceURI) { function setSourceLocURI($sourceURI) {
$this->_sourceLocURI = $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. * Setter for property targetURI.
@ -308,6 +320,10 @@ class Horde_SyncML_Sync {
$replace = true; $replace = true;
$ok = false; $ok = false;
$merge = false; $merge = false;
if ($hordeType == 'configuration')
{
$command->setStatus(RESPONSE_ALREADY_EXISITS);
}
if ($guid) if ($guid)
{ {
Horde::logMessage('SyncML: locuri '. $locURI . ' guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_DEBUG); Horde::logMessage('SyncML: locuri '. $locURI . ' guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_DEBUG);
@ -317,12 +333,13 @@ class Horde_SyncML_Sync {
switch ($sync_conflicts) switch ($sync_conflicts)
{ {
case CONFLICT_CLIENT_WINNING: case CONFLICT_CLIENT_WINNING:
$command->setStatus(RESPONSE_CONFLICT_RESOLVED_WITH_CLIENT_WINNING); $command->setStatus(RESPONSE_CONFLICT_RESOLVED_WITH_CLIENT_WINS);
break; break;
case CONFLICT_SERVER_WINNING: case CONFLICT_SERVER_WINNING:
Horde::logMessage('SyncML: REJECT client change for locuri ' . Horde::logMessage('SyncML: REJECT client change for locuri ' .
$locURI . ' guid ' . $guid , $locURI . ' guid ' . $guid ,
__FILE__, __LINE__, PEAR_LOG_WARNING); __FILE__, __LINE__, PEAR_LOG_WARNING);
$command->setStatus(RESPONSE_CONFLICT_RESOLVED_WITH_SERVER_WINS);
$ok = true; $ok = true;
$replace = false; $replace = false;
$state->log('Client-AddReplaceIgnored'); $state->log('Client-AddReplaceIgnored');
@ -331,6 +348,7 @@ class Horde_SyncML_Sync {
Horde::logMessage('SyncML: Merge server and client data for locuri ' . Horde::logMessage('SyncML: Merge server and client data for locuri ' .
$locURI . ' guid ' . $guid , $locURI . ' guid ' . $guid ,
__FILE__, __LINE__, PEAR_LOG_WARNING); __FILE__, __LINE__, PEAR_LOG_WARNING);
$command->setStatus(RESPONSE_CONFLICT_RESOLVED_WITH_MERGE);
$merge = true; $merge = true;
break; break;
case CONFLICT_RESOLVED_WITH_DUPLICATE: case CONFLICT_RESOLVED_WITH_DUPLICATE:
@ -340,6 +358,7 @@ class Horde_SyncML_Sync {
Horde::logMessage('SyncML: Server RO! REJECT client change for locuri ' . Horde::logMessage('SyncML: Server RO! REJECT client change for locuri ' .
$locURI . ' guid ' . $guid , $locURI . ' guid ' . $guid ,
__FILE__, __LINE__, PEAR_LOG_WARNING); __FILE__, __LINE__, PEAR_LOG_WARNING);
$command->setStatus(RESPONSE_PERMISSION_DENIED);
$ok = true; $ok = true;
$replace = false; $replace = false;
$ts = $state->getSyncTSforAction($guid, 'modify'); $ts = $state->getSyncTSforAction($guid, 'modify');
@ -350,6 +369,7 @@ class Horde_SyncML_Sync {
Horde::logMessage('SyncML: Server RO! UNDO client change for locuri ' . Horde::logMessage('SyncML: Server RO! UNDO client change for locuri ' .
$locURI . ' guid ' . $guid , $locURI . ' guid ' . $guid ,
__FILE__, __LINE__, PEAR_LOG_WARNING); __FILE__, __LINE__, PEAR_LOG_WARNING);
$command->setStatus(RESPONSE_PERMISSION_DENIED);
$state->pushChangedItem($type, $guid); $state->pushChangedItem($type, $guid);
$ok = true; $ok = true;
$replace = false; $replace = false;

View File

@ -244,6 +244,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
. ' guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_WARNING); . ' guid ' . $guid , __FILE__, __LINE__, PEAR_LOG_WARNING);
if ($sync_conflicts != CONFLICT_RESOLVED_WITH_DUPLICATE) { if ($sync_conflicts != CONFLICT_RESOLVED_WITH_DUPLICATE) {
$state->log("Client-AddReplaceIgnored"); $state->log("Client-AddReplaceIgnored");
$command->setStatus(RESPONSE_CONFILCT_RESOLVED_WITH_DUPLICATE);
continue; continue;
} }
} else { } else {
@ -252,6 +253,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
__FILE__, __LINE__, PEAR_LOG_DEBUG); __FILE__, __LINE__, PEAR_LOG_DEBUG);
$state->setUID($type, $locURI, $guid); $state->setUID($type, $locURI, $guid);
$state->log("Client-Map"); $state->log("Client-Map");
$command->setStatus(RESPONSE_ALREADY_EXISITS);
continue; continue;
} }
} }

View File

@ -151,3 +151,13 @@ $this->applications['egwcaltaskssync'] = array(
'menu_parent' => 'organizing' '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'
);