SyncML fixes

This commit is contained in:
Lars Kneschke 2006-06-01 13:38:37 +00:00
parent 31d02fcbf5
commit fcbe2e5dd5
4 changed files with 33 additions and 4 deletions

View File

@ -56,6 +56,11 @@ class Horde_SyncML_Command_Sync_ContentSyncElement extends Horde_SyncML_Command_
$this->_contentType = $c;
}
function setContentFormat($_format)
{
$this->_contentFormat = $_format;
}
function getContentType()
{
return $this->_contentType;
@ -116,6 +121,14 @@ class Horde_SyncML_Command_Sync_ContentSyncElement extends Horde_SyncML_Command_
$output->endElement($state->getURI(), 'LocURI');
$output->endElement($state->getURI(), 'Source');
}
if(isset($this->_contentFormat)) {
$output->startElement($state->getURI(), 'Meta', $attrs);
$output->startElement($state->getURIMeta(), 'Format', $attrs);
$output->characters($this->_contentFormat);
$output->endElement($state->getURIMeta(), 'Format');
$output->endElement($state->getURI(), 'Meta');
}
if ($this->_targetURI != null) {
$output->startElement($state->getURI(), 'Target', $attrs);

View File

@ -309,18 +309,25 @@ class EGW_SyncML_State extends Horde_SyncML_State
$mapID = $this->_locName . $this->_sourceURI . $type;
// delete all client id's
$where = array(
'map_id' => $mapID,
'map_locuid' => $locid,
);
$db->delete('egw_contentmap', $where, __LINE__, __FILE__);
// delete all egw id's
$where = array(
'map_id' => $mapID,
'map_guid' => $guid,
);
$db->delete('egw_contentmap', $where, __LINE__, __FILE__);
$data = $where + array(
'map_locuid' => $locid,
'map_timestamp' => $ts,
'map_expired' => 0,
);
$db->delete('egw_contentmap', $where, __LINE__, __FILE__);
$db->insert('egw_contentmap', $data, $where, __LINE__, __FILE__);
#Horde::logMessage("SyncML: setUID $type, $locid, $guid, $ts $mapID", __FILE__, __LINE__, PEAR_LOG_DEBUG);

View File

@ -73,6 +73,9 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
// can happen.
#LK $cmd->setContent($state->convertServer2Client($c, $contentType));
$cmd->setContent($c);
if($hordeType == 'sifcalendar' || $hordeType == 'sifcontacts' || $hordeType == 'siftasks') {
$cmd->setContentFormat('b64');
}
$cmd->setContentType($contentType['ContentType']);
$cmd->setSourceURI($guid);
$currentCmdID = $cmd->outputCommand($currentCmdID, $output, 'Add');

View File

@ -99,11 +99,14 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync {
$cmd->setSourceURI($guid);
$cmd->setTargetURI($locid);
$cmd->setContentType($contentType['ContentType']);
if($hordeType == 'sifcalendar' || $hordeType == 'sifcontacts' || $hordeType == 'siftasks') {
$cmd->setContentFormat('b64');
}
$currentCmdID = $cmd->outputCommand($currentCmdID, $output, 'Replace');
$state->log('Server-Replace');
// return if we have to much data
if(++$counter >= MAX_ENTRIES && $hordeType != 'sifcalender' && $hordeType != 'sifcontacts' &&$hordeType != 'siftasks') {
if(++$counter >= MAX_ENTRIES && $hordeType != 'sifcalendar' && $hordeType != 'sifcontacts' && $hordeType != 'siftasks') {
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
return $currentCmdID;
}
@ -194,13 +197,16 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync {
if (!is_a($c, 'PEAR_Error')) {
// Item in history but not in database. Strange, but can happen.
$cmd->setContent($c);
if($hordeType == 'sifcalendar' || $hordeType == 'sifcontacts' || $hordeType == 'siftasks') {
$cmd->setContentFormat('b64');
}
$cmd->setContentType($contentType['ContentType']);
$cmd->setSourceURI($guid);
$currentCmdID = $cmd->outputCommand($currentCmdID, $output, 'Add');
$state->log('Server-Add');
// return if we have to much data
if(++$counter >= MAX_ENTRIES && $hordeType != 'sifcalender' && $hordeType != 'sifcontacts' &&$hordeType != 'siftasks') {
if(++$counter >= MAX_ENTRIES && $hordeType != 'sifcalendar' && $hordeType != 'sifcontacts' &&$hordeType != 'siftasks') {
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
return $currentCmdID;
}