Skip to content

Commit

Permalink
Bug: 12970 Don't overwrite sticky OPTIONS.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Oct 29, 2014
1 parent 8a93cb4 commit 3902eb2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
25 changes: 19 additions & 6 deletions framework/ActiveSync/lib/Horde/ActiveSync/Collections.php
Expand Up @@ -257,17 +257,30 @@ public function __set($property, $value)
public function getNewCollection()
{
return array(
'truncation' => Horde_ActiveSync::TRUNCATION_ALL,
'clientids' => array(),
'fetchids' => array(),
'windowsize' => 100,
'conflict' => Horde_ActiveSync::CONFLICT_OVERWRITE_PIM,
'bodyprefs' => array(),
'mimesupport' => Horde_ActiveSync::MIME_SUPPORT_NONE,
'mimetruncation' => Horde_ActiveSync::TRUNCATION_8,
'windowsize' => 100
);
}

/**
* Populate default OPTIONS values.
*
* @param array $collection The collection array.
* @since 2.20.0
*/
public function getDefaultOptions(array &$collection)
{
$this->_logger->info(sprintf(
'[%s] Loading default OPTIONS for collection.', $this->_procid));
$collection['conflict'] = Horde_ActiveSync::CONFLICT_OVERWRITE_PIM;
$collection['mimetruncation'] = Horde_ActiveSync::TRUNCATION_8;
$collection['mimesupport'] = Horde_ActiveSync::MIME_SUPPORT_NONE;
$collection['truncation'] = Horde_ActiveSync::TRUNCATION_ALL;
$collection['bodyprefs'] = array();
}


/**
* Add a new populated collection array to the sync cache.
*
Expand Down
5 changes: 5 additions & 0 deletions framework/ActiveSync/lib/Horde/ActiveSync/Request/Sync.php
Expand Up @@ -676,6 +676,7 @@ protected function _parseSyncFolders()
{
while ($this->_decoder->getElementStartTag(Horde_ActiveSync::SYNC_FOLDER)) {
$collection = $this->_collections->getNewCollection();
$haveOptions = false;
while (($folder_tag = ($this->_decoder->getElementStartTag(Horde_ActiveSync::SYNC_FOLDERTYPE) ? Horde_ActiveSync::SYNC_FOLDERTYPE :
($this->_decoder->getElementStartTag(Horde_ActiveSync::SYNC_SYNCKEY) ? Horde_ActiveSync::SYNC_SYNCKEY :
($this->_decoder->getElementStartTag(Horde_ActiveSync::SYNC_FOLDERID) ? Horde_ActiveSync::SYNC_FOLDERID :
Expand Down Expand Up @@ -796,6 +797,7 @@ protected function _parseSyncFolders()
case Horde_ActiveSync::SYNC_OPTIONS:
if (!$this->_decoder->isEmptyElement($this->_decoder->getLastStartElement())) {
$this->_parseSyncOptions($collection);
$haveOptions = true;
}
break;

Expand All @@ -805,6 +807,9 @@ protected function _parseSyncFolders()
}
}
}
if (!$haveOptions) {
$this->_collections->getDefaultOptions($collection);
}

if (!$this->_decoder->getElementEndTag()) {
$this->_statusCode = self::STATUS_PROTERROR;
Expand Down

0 comments on commit 3902eb2

Please sign in to comment.