we must return status 12 otherwise we break other devices
authorLars Kneschke <l.kneschke@metaways.de>
Thu, 1 Mar 2012 14:27:05 +0000 (15:27 +0100)
committerLars Kneschke <l.kneschke@metaways.de>
Thu, 1 Mar 2012 14:27:05 +0000 (15:27 +0100)
lib/Syncope/Command/Sync.php
tests/Syncope/Command/SyncTests.php

index 16f2ff0..0708b9d 100644 (file)
@@ -370,12 +370,7 @@ class Syncope_Command_Sync extends Syncope_Command_Wbxml
                 $collection = $collections->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'Collection'));
                 $collection->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'SyncKey', 0));
                 $collection->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'CollectionId', $collectionData['collectionId']));
-                /**
-                 * i would expect to send STATUS_FOLDER_HIERARCHY_HAS_CHANGED but by reading the source code of Android I found out
-                 * that android triggers the FolderSync only on STATUS_OBJECT_NOT_FOUND
-                 */
-                #$collection->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'Status', self::STATUS_FOLDER_HIERARCHY_HAS_CHANGED));
-                $collection->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'Status', self::STATUS_OBJECT_NOT_FOUND));
+                $collection->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'Status', self::STATUS_FOLDER_HIERARCHY_HAS_CHANGED));
 
             // invalid synckey provided
             } elseif (! ($collectionData['syncState'] instanceof Syncope_Model_ISyncState)) {
@@ -385,7 +380,6 @@ class Syncope_Command_Sync extends Syncope_Command_Wbxml
                 $collection->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'CollectionId', $collectionData['collectionId']));
                 $collection->appendChild($this->_outputDom->createElementNS('uri:AirSync', 'Status', self::STATUS_INVALID_SYNC_KEY));
                 
-
             // initial sync
             } elseif ($collectionData['syncState']->counter === 0) {
                 $collectionData['syncState']->counter++;
index 8dbe73b..7fd749d 100644 (file)
@@ -86,7 +86,7 @@ class Syncope_Command_SyncTests extends Syncope_Command_ATestCase
         
         $nodes = $xpath->query('//AirSync:Sync/AirSync:Collections/AirSync:Collection/AirSync:Status');
         $this->assertEquals(1, $nodes->length, $syncDoc->saveXML());
-        $this->assertEquals(Syncope_Command_Sync::STATUS_OBJECT_NOT_FOUND, $nodes->item(0)->nodeValue, $syncDoc->saveXML());
+        $this->assertEquals(Syncope_Command_Sync::STATUS_FOLDER_HIERARCHY_HAS_CHANGED, $nodes->item(0)->nodeValue, $syncDoc->saveXML());
     }
     
     /**
@@ -116,7 +116,7 @@ class Syncope_Command_SyncTests extends Syncope_Command_ATestCase
         
         $nodes = $xpath->query('//AirSync:Sync/AirSync:Collections/AirSync:Collection/AirSync:Status');
         $this->assertEquals(1, $nodes->length, $syncDoc->saveXML());
-        $this->assertEquals(Syncope_Command_Sync::STATUS_OBJECT_NOT_FOUND, $nodes->item(0)->nodeValue, $syncDoc->saveXML());
+        $this->assertEquals(Syncope_Command_Sync::STATUS_FOLDER_HIERARCHY_HAS_CHANGED, $nodes->item(0)->nodeValue, $syncDoc->saveXML());
     }
     
     /**