merge from trunk

This commit is contained in:
Lars Kneschke 2007-06-25 09:00:22 +00:00
parent ecbcdb0e70
commit b3c26c09c7
7 changed files with 61 additions and 15 deletions

View File

@ -484,7 +484,7 @@ class Horde_SyncML_SyncMLBody extends Horde_SyncML_ContentHandler {
$state = & $_SESSION['SyncML.state'];
// <SyncML><SyncBody><[Command]>
Horde::logMessage('SyncML['. session_id() ."]: found command $element ", __FILE__, __LINE__, PEAR_LOG_DEBUG);
#Horde::logMessage('SyncML['. session_id() ."]: found command $element ", __FILE__, __LINE__, PEAR_LOG_DEBUG);
$this->_currentCommand = Horde_SyncML_Command::factory($element);
$this->_currentCommand->startElement($uri, $element, $attrs);

View File

@ -25,7 +25,7 @@ class Horde_SyncML_Command_Results extends Horde_SyncML_Command {
var $_deviceInfo;
function endElement($uri, $element) {
#Horde::logMessage('SyncML: put endelement ' . $element . ' stack ' . $this->_xmlStack, __FILE__, __LINE__, PEAR_LOG_DEBUG);
#Horde::logMessage('SyncML: put endelement ' . $element . ' chars ' . $this->_chars, __FILE__, __LINE__, PEAR_LOG_DEBUG);
switch ($this->_xmlStack) {
case 5:
@ -40,7 +40,18 @@ class Horde_SyncML_Command_Results extends Horde_SyncML_Command {
break;
case 'DevID':
switch(trim($this->_chars)) {
case 'fmz-thunderbird-plugin':
$this->_deviceInfo['deviceID'] = trim($this->_chars);
$this->_deviceInfo['manufacturer'] = 'funambol';
$this->_deviceInfo['model'] = trim($this->_chars);
break;
default:
$this->_deviceInfo['deviceID'] = trim($this->_chars);
break;
}
break;
case 'DevTyp':

View File

@ -117,6 +117,7 @@ class Horde_SyncML_Command_Sync_ContentSyncElement extends Horde_SyncML_Command_
$output->startElement($state->getURI(), 'Source', $attrs);
$output->startElement($state->getURI(), 'LocURI', $attrs);
$chars = substr($this->_locURI,0,39);
$state->setUIDMapping($this->_locURI, $chars);
$output->characters($chars);
$output->endElement($state->getURI(), 'LocURI');
$output->endElement($state->getURI(), 'Source');

View File

@ -203,6 +203,11 @@ class Horde_SyncML_State {
// stores if we already requested the deviceinfo
var $_devinfoRequested = false;
/*
* store the mappings of egw uids to client uids
*/
var $_uidMappings = array();
/**
* Creates a new instance of Horde_SyncML_State.
*/
@ -218,6 +223,24 @@ class Horde_SyncML_State {
$this->isAuthorized = false;
}
/**
* store the sent global uid
*/
function setUIDMapping($_realEgwUid, $_sentEgwUid) {
$this->_uidMappings[$_sentEgwUid] = $_realEgwUid;
}
/**
* retrieve the real egw uid for a given send uid
*/
function getUIDMapping($_sentEgwUid) {
if(isset($this->_uidMappings[$_sentEgwUid])) {
return $this->_uidMappings[$_sentEgwUid];
}
return false;
}
/**
* Returns the DataTree used as persistence layer for SyncML. The
* datatree var should not be a class member of State as State is

View File

@ -6,6 +6,11 @@ class EGW_SyncML_State extends Horde_SyncML_State
{
var $table_devinfo = 'egw_syncmldevinfo';
/*
* store the mappings of egw uids to client uids
*/
var $uidMappings = array();
/**
* Returns the timestamp (if set) of the last change to the
* obj:guid, that was caused by the client. This is stored to
@ -323,22 +328,28 @@ class EGW_SyncML_State extends Horde_SyncML_State
* have different syncs with different devices. If an entry
* already exists, it is overwritten.
*/
function setUID($type, $locid, $guid, $ts=0)
function setUID($type, $locid, $_guid, $ts=0)
{
#Horde::logMessage("SyncML: setUID $type, $locid, $guid, $ts ", __FILE__, __LINE__, PEAR_LOG_DEBUG);
#Horde::logMessage("SyncML: setUID ". $this->getUIDMapping($guid), __FILE__, __LINE__, PEAR_LOG_DEBUG);
// fix $guid, it maybe was to long for some devices
// format is appname-id-systemid
$guidParts = explode('-',$guid);
if(count($guidParts) == 3)
{
$guid = $GLOBALS['egw']->common->generate_uid($guidParts[0],$guidParts[1]);
}
#$guidParts = explode('-',$guid);
#if(count($guidParts) == 3) {
# $guid = $GLOBALS['egw']->common->generate_uid($guidParts[0],$guidParts[1]);
#}
if($ts == 0)
{
$guid = $this->getUIDMapping($_guid);
if($guid === false) {
Horde::logMessage("SyncML: setUID $type, $locid, $guid something went wrong!!! Mapping not found.", __FILE__, __LINE__, PEAR_LOG_INFO);
return false;
}
Horde::logMessage("SyncML: setUID $_guid => $guid", __FILE__, __LINE__, PEAR_LOG_DEBUG);
if($ts == 0) {
$ts = time();
}
#Horde::logMessage("SyncML: setUID $type, $locid, $guid, $ts ".count($guidParts), __FILE__, __LINE__, PEAR_LOG_DEBUG);
Horde::logMessage("SyncML: setUID $type, $locid, $guid, $ts ", __FILE__, __LINE__, PEAR_LOG_DEBUG);
$db = clone($GLOBALS['egw']->db);

View File

@ -44,7 +44,7 @@ class Horde_SyncML_Sync_RefreshFromServerSync extends Horde_SyncML_Sync_TwoWaySy
$cmd = &new Horde_SyncML_Command_Sync_ContentSyncElement();
$c = $registry->call($hordeType . '/export', array('guid' => $guid, 'contentType' => $contentType));
Horde::logMessage("SyncML: slowsync add to client $c", __FILE__, __LINE__, PEAR_LOG_DEBUG);
Horde::logMessage("SyncML: slowsync add $guid to client ". print_r($c, true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
if (!is_a($c, 'PEAR_Error')) {
$cmd->setContent($c);
if($hordeType == 'sifcalendar' || $hordeType == 'sifcontacts' || $hordeType == 'siftasks') {

View File

@ -46,7 +46,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
$cmd = &new Horde_SyncML_Command_Sync_ContentSyncElement();
$c = $registry->call($hordeType . '/export', array('guid' => $guid, 'contentType' => $contentType));
Horde::logMessage("SyncML: slowsync add to client $c", __FILE__, __LINE__, PEAR_LOG_DEBUG);
#Horde::logMessage("SyncML: slowsync add guid $guid to client ". print_r($c, true), __FILE__, __LINE__, PEAR_LOG_DEBUG);
if (!is_a($c, 'PEAR_Error')) {
$cmd->setContent($c);
if($hordeType == 'sifcalendar' || $hordeType == 'sifcontacts' || $hordeType == 'siftasks') {