Commit 8e811dba authored by skummer's avatar skummer

ZP-529 #comment allow random tag order for ItemOperations Fetch, simplyfied...

ZP-529 #comment allow random tag order for ItemOperations Fetch, simplyfied checking for empty options tag

git-svn-id: https://z-push.org/svn/z-push/trunk@1884 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 6dc871e3
...@@ -90,12 +90,14 @@ class ItemOperations extends RequestProcessor { ...@@ -90,12 +90,14 @@ class ItemOperations extends RequestProcessor {
return false; return false;
} }
// process operation
while(1) {
if ($fetch) { if ($fetch) {
if(!self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_STORE)) if(self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_STORE)) {
return false;
$operation['store'] = self::$decoder->getElementContent(); $operation['store'] = self::$decoder->getElementContent();
if(!self::$decoder->getElementEndTag()) if(!self::$decoder->getElementEndTag())
return false;//SYNC_ITEMOPERATIONS_STORE return false;//SYNC_ITEMOPERATIONS_STORE
}
if(self::$decoder->getElementStartTag(SYNC_SEARCH_LONGID)) { if(self::$decoder->getElementStartTag(SYNC_SEARCH_LONGID)) {
$operation['longid'] = self::$decoder->getElementContent(); $operation['longid'] = self::$decoder->getElementContent();
...@@ -121,7 +123,7 @@ class ItemOperations extends RequestProcessor { ...@@ -121,7 +123,7 @@ class ItemOperations extends RequestProcessor {
return false;//SYNC_AIRSYNCBASE_FILEREFERENCE return false;//SYNC_AIRSYNCBASE_FILEREFERENCE
} }
if(self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_OPTIONS)) { if(($el = self::$decoder->getElementStartTag(SYNC_ITEMOPERATIONS_OPTIONS)) && ($el[EN_FLAGS] & EN_FLAGS_CONTENT)) {
//TODO other options //TODO other options
//schema //schema
//range //range
...@@ -133,12 +135,6 @@ class ItemOperations extends RequestProcessor { ...@@ -133,12 +135,6 @@ class ItemOperations extends RequestProcessor {
// Save all OPTIONS into a ContentParameters object // Save all OPTIONS into a ContentParameters object
$operation["cpo"] = new ContentParameters(); $operation["cpo"] = new ContentParameters();
while(1) { while(1) {
// Android 4.3 sends empty options tag, so we don't have to look further
$e = self::$decoder->peek();
if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
break;
}
while (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_BODYPREFERENCE)) { while (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_BODYPREFERENCE)) {
if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TYPE)) { if(self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TYPE)) {
$bptype = self::$decoder->getElementContent(); $bptype = self::$decoder->getElementContent();
...@@ -203,7 +199,7 @@ class ItemOperations extends RequestProcessor { ...@@ -203,7 +199,7 @@ class ItemOperations extends RequestProcessor {
} }
} }
} }
} } // end if fetch
if ($efc) { if ($efc) {
if(self::$decoder->getElementStartTag(SYNC_FOLDERID)) { if(self::$decoder->getElementStartTag(SYNC_FOLDERID)) {
...@@ -226,8 +222,13 @@ class ItemOperations extends RequestProcessor { ...@@ -226,8 +222,13 @@ class ItemOperations extends RequestProcessor {
//TODO move //TODO move
if(!self::$decoder->getElementEndTag()) //break if it reached the endtag SYNC_ITEMOPERATIONS_FETCH or SYNC_ITEMOPERATIONS_EMPTYFOLDERCONTENTS or SYNC_ITEMOPERATIONS_MOVE
return false; //SYNC_ITEMOPERATIONS_FETCH or SYNC_ITEMOPERATIONS_EMPTYFOLDERCONTENTS or SYNC_ITEMOPERATIONS_MOVE $e = self::$decoder->peek();
if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
self::$decoder->getElementEndTag();
break;
}
} // end while operation
$itemoperations[] = $operation; $itemoperations[] = $operation;
//break if it reached the endtag //break if it reached the endtag
...@@ -236,11 +237,7 @@ class ItemOperations extends RequestProcessor { ...@@ -236,11 +237,7 @@ class ItemOperations extends RequestProcessor {
self::$decoder->getElementEndTag(); //SYNC_ITEMOPERATIONS_ITEMOPERATIONS self::$decoder->getElementEndTag(); //SYNC_ITEMOPERATIONS_ITEMOPERATIONS
break; break;
} }
} // end operations loop
}
// if(!self::$decoder->getElementEndTag())
// return false;//SYNC_ITEMOPERATIONS_ITEMOPERATIONS
$status = SYNC_ITEMOPERATIONSSTATUS_SUCCESS; $status = SYNC_ITEMOPERATIONSSTATUS_SUCCESS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment