Commit ac1e300d authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-54 Outlook does send Notes folders, but as Tasks. States have to be

loaded for these cases as well. Removed GetSynchedFolderIds from
DeviceManager. Changed order in checks to get a bit more performance.
parent 5350a409
......@@ -443,27 +443,6 @@ class DeviceManager {
return false;
}
/**
* Returns a list of all synchronized folders. If type is false, all types are returned.
* If only certain folders are required, set the AS type here.
*
* @param array $type A list of AS foldertypes, if empty, returns all
*
* @access public
* @return array
*/
public function GetSynchronizedFolderIds($types = array()) {
$synched = array();
foreach($this->device->GetAllFolderIds() as $folderid) {
if ($this->device->GetFolderUUID($folderid)) {
if (empty($types) || in_array($this->device->GetFolderType($folderid), $types)) {
$synched[] = $folderid;
}
}
}
return $synched;
}
/**
* Checks if the message should be streamed to a mobile
* Should always be called before a message is sent to the mobile
......
......@@ -89,7 +89,7 @@ class ImportChangesStream implements IImportChanges {
}
// Acacia ZO-42: to sync Notes to Outlook we sync them as Tasks
if ( ZPush::GetDeviceManager()->IsOutlookClient() && $this->classAsString == "SyncNote") {
if ($this->classAsString == "SyncNote" && ZPush::GetDeviceManager()->IsOutlookClient()) {
$task = new SyncTask();
$task->flags = $message->flags;
if (isset($message->asbody))
......
......@@ -102,11 +102,6 @@ class Ping extends RequestProcessor {
// cache requested (pingable) folderids
$pingable = array();
// Acacia ZO-42: Outlook does never request Ping for Notes folder, so we add them manually if they are synched
if (self::$deviceManager->IsOutlookClient()) {
$pingable = self::$deviceManager->GetSynchronizedFolderIds(array(SYNC_FOLDER_TYPE_NOTE, SYNC_FOLDER_TYPE_USER_NOTE));
}
while(self::$decoder->getElementStartTag(SYNC_PING_FOLDER)) {
WBXMLDecoder::ResetInWhile("pingFolder");
while(WBXMLDecoder::InWhile("pingFolder")) {
......@@ -142,11 +137,10 @@ class Ping extends RequestProcessor {
$fakechanges[$folderid] = 1;
$foundchanges = true;
}
else if ($class == $spa->GetContentClass()) {
else if ($this->isClassValid($class, $spa)) {
$pingable[] = $folderid;
ZLog::Write(LOGLEVEL_DEBUG, sprintf("HandlePing(): using saved sync state for '%s' id '%s'", $spa->GetContentClass(), $folderid));
}
}
if(!self::$decoder->getElementEndTag())
return false;
......@@ -277,4 +271,23 @@ class Ping extends RequestProcessor {
}
return true;
}
/**
* Checks if a sent folder class is valid for that SyncParameters object.
*
* @param string $class
* @param SycnParameters $spa
*
* @access public
* @return boolean
*/
private function isClassValid($class, $spa) {
if ($class == $spa->GetContentClass() ||
// Acacia ZO-42: Notes are synched as Tasks
(self::$deviceManager->IsOutlookClient() && $class == "Tasks" && $spa->GetContentClass() == "Notes")
) {
return true;
}
return false;
}
}
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