mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-04 20:40:14 +01:00
made refresh from server working
the new funambol outlook client support this
This commit is contained in:
parent
6a86c442a3
commit
d999a797d4
@ -102,7 +102,7 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command {
|
|||||||
$state->setServerAnchorLast($type, 0);
|
$state->setServerAnchorLast($type, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Horde::logMessage("SyncML: checking anchor \$clientlast " . $clientlast .' '. $this->_metaAnchorLast .' '. $clientlast == $this->_metaAnchorLast, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
Horde::logMessage('SyncML: checking anchor targetLocURI: clientlast: ' . $clientlast .' / '. $this->_metaAnchorLast, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
|
||||||
// Set Server Anchor for this sync to current time.
|
// Set Server Anchor for this sync to current time.
|
||||||
$state->setServerAnchorNext($type,time());
|
$state->setServerAnchorNext($type,time());
|
||||||
@ -339,7 +339,7 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command {
|
|||||||
|
|
||||||
$state->setSync($this->_targetLocURI, $sync);
|
$state->setSync($this->_targetLocURI, $sync);
|
||||||
|
|
||||||
if($this->_alert == ALERT_SLOW_SYNC) {
|
if($this->_alert == ALERT_SLOW_SYNC || $this->_alert == ALERT_REFRESH_FROM_SERVER) {
|
||||||
$state->removeAllUID($this->_targetLocURI);
|
$state->removeAllUID($this->_targetLocURI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ include_once 'Horde/SyncML/Command/Sync/SyncElement.php';
|
|||||||
include_once 'Horde/SyncML/Sync/TwoWaySync.php';
|
include_once 'Horde/SyncML/Sync/TwoWaySync.php';
|
||||||
include_once 'Horde/SyncML/Sync/SlowSync.php';
|
include_once 'Horde/SyncML/Sync/SlowSync.php';
|
||||||
include_once 'Horde/SyncML/Sync/OneWayFromServerSync.php';
|
include_once 'Horde/SyncML/Sync/OneWayFromServerSync.php';
|
||||||
|
include_once 'Horde/SyncML/Sync/RefreshFromServerSync.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $Horde: framework/SyncML/SyncML/Command/Sync.php,v 1.17 2004/07/03 15:21:14 chuck Exp $
|
* $Horde: framework/SyncML/SyncML/Command/Sync.php,v 1.17 2004/07/03 15:21:14 chuck Exp $
|
||||||
|
@ -15,50 +15,75 @@ include_once 'Horde/SyncML/Sync.php';
|
|||||||
* @since Horde 3.0
|
* @since Horde 3.0
|
||||||
* @package Horde_SyncML
|
* @package Horde_SyncML
|
||||||
*/
|
*/
|
||||||
class Horde_SyncML_Sync_RefreshFromServerSync extends Horde_SyncML_Sync {
|
class Horde_SyncML_Sync_RefreshFromServerSync extends Horde_SyncML_Sync_TwoWaySync {
|
||||||
|
function handleSync($currentCmdID, $hordeType, $syncType, &$output, $refts) {
|
||||||
function endSync($currentCmdID, &$output)
|
|
||||||
{
|
|
||||||
global $registry;
|
global $registry;
|
||||||
|
|
||||||
|
$history = $GLOBALS['egw']->contenthistory;
|
||||||
$state = &$_SESSION['SyncML.state'];
|
$state = &$_SESSION['SyncML.state'];
|
||||||
|
|
||||||
// counter for synced items
|
|
||||||
$syncItems = 0;
|
|
||||||
|
|
||||||
if(!$adds = &$state->getAddedItems($hordeType))
|
|
||||||
{
|
|
||||||
Horde::logMessage("SyncML: reading list of added items", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
$adds = $registry->call($this->targetLocURI, '/list', array());
|
|
||||||
$adds = &$state->getAddedItems($hordeType);
|
$adds = &$state->getAddedItems($hordeType);
|
||||||
|
|
||||||
|
Horde::logMessage("SyncML: ".count($adds). ' added items found for '.$hordeType , __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
|
||||||
|
$serverAnchorNext = $state->getServerAnchorNext($syncType);
|
||||||
|
$counter = 0;
|
||||||
|
|
||||||
|
if(is_array($adds)) {
|
||||||
|
while($guid = array_shift($adds)) {
|
||||||
|
if ($locID = $state->getLocID($syncType, $guid)) {
|
||||||
|
Horde::logMessage("SyncML: RefreshFromServerSync add to client: $guid ignored, already at client($locID)", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
Horde::logMessage("SyncML: ....... ".count($adds).' items to send ..............', __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
|
|
||||||
#foreach ($add as $adds) {
|
$contentType = $state->getPreferedContentTypeClient($this->_sourceLocURI);
|
||||||
while($guid = array_shift($adds))
|
if(is_a($contentType, 'PEAR_Error')) {
|
||||||
{
|
// Client did not sent devinfo
|
||||||
$locid = $this->_currentState->getLocID($this->targetLocURI, $guid);
|
$contentType = array('ContentType' => $state->getPreferedContentType($this->_targetLocURI));
|
||||||
// Add a replace.
|
}
|
||||||
$add = &new Horde_SyncML_Command_Sync_ContentSyncElement();
|
|
||||||
|
|
||||||
$add->setContent($registry->call($this->targetLocURI . '/listByAction',
|
$cmd = &new Horde_SyncML_Command_Sync_ContentSyncElement();
|
||||||
array($this->_currentState->getPreferedContentType($this->targetLocURI))));
|
$c = $registry->call($hordeType . '/export', array('guid' => $guid, 'contentType' => $contentType));
|
||||||
|
Horde::logMessage("SyncML: slowsync add to client $c", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
if (!is_a($c, 'PEAR_Error')) {
|
||||||
|
$cmd->setContent($c);
|
||||||
|
if($hordeType == 'sifcalendar' || $hordeType == 'sifcontacts' || $hordeType == 'siftasks') {
|
||||||
|
$cmd->setContentFormat('b64');
|
||||||
|
}
|
||||||
|
|
||||||
$currentCmdID = $add->outputCommand($currentCmdID, $output, 'Add');
|
$cmd->setContentType($contentType['ContentType']);
|
||||||
|
$cmd->setSourceURI($guid);
|
||||||
|
$currentCmdID = $cmd->outputCommand($currentCmdID, $output, 'Add');
|
||||||
|
$state->log('Server-Add');
|
||||||
|
|
||||||
$syncItems++;
|
|
||||||
// return if we have to much data
|
// return if we have to much data
|
||||||
if($syncItems >= MAX_ENTRIES)
|
if(++$counter >= MAX_ENTRIES && $hordeType != 'sifcalendar' && $hordeType != 'sifcontacts' && $hordeType != 'siftasks') {
|
||||||
{
|
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
||||||
$state->setMoreDataPending();
|
|
||||||
return $currentCmdID;
|
return $currentCmdID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO deletes
|
#Horde::logMessage("SyncML: handling sync ".$currentCmdID, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
|
||||||
// TODO modifies
|
$state->clearSync($syncType);
|
||||||
|
|
||||||
return $currentCmdID;
|
return $currentCmdID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadData() {
|
||||||
|
global $registry;
|
||||||
|
|
||||||
|
$state = &$_SESSION['SyncML.state'];
|
||||||
|
$syncType = $this->_targetLocURI;
|
||||||
|
$hordeType = str_replace('./','',$syncType);
|
||||||
|
|
||||||
|
Horde::logMessage("SyncML: reading added items from database for $hordeType", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
$state->setAddedItems($hordeType, $registry->call($hordeType. '/list', array()));
|
||||||
|
$adds = &$state->getAddedItems($hordeType);
|
||||||
|
$this->_syncDataLoaded = TRUE;
|
||||||
|
|
||||||
|
return count($state->getAddedItems($hordeType));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,9 +174,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadData() {
|
||||||
function loadData()
|
|
||||||
{
|
|
||||||
global $registry;
|
global $registry;
|
||||||
|
|
||||||
$state = &$_SESSION['SyncML.state'];
|
$state = &$_SESSION['SyncML.state'];
|
||||||
@ -190,5 +188,4 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
|||||||
|
|
||||||
return count($state->getAddedItems($hordeType));
|
return count($state->getAddedItems($hordeType));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,13 +36,6 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync {
|
|||||||
$output,
|
$output,
|
||||||
$refts);
|
$refts);
|
||||||
|
|
||||||
#if ($syncType == 'calendar' && $state->handleTasksInCalendar()) {
|
|
||||||
# Horde::logMessage("SyncML: handling tasks in calendar sync", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
|
||||||
#
|
|
||||||
# $currentCmdID = $this->handleSync($currentCmdID, 'tasks', $syncType,
|
|
||||||
# $output, $refts);
|
|
||||||
#}
|
|
||||||
|
|
||||||
return $currentCmdID;
|
return $currentCmdID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user