fix problem with AlterPingChanges with non selectable folders

This commit is contained in:
Klaus Leithoff 2016-10-25 11:39:23 +00:00
parent 910b92acca
commit dbc31d5ccb

View File

@ -1783,14 +1783,20 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
if ($type != 'mail') return false; if ($type != 'mail') return false;
if (!isset($this->mail)) $this->mail = Mail::getInstance(false,self::$profileID,true,false,true); if (!isset($this->mail)) $this->mail = Mail::getInstance(false,self::$profileID,true,false,true);
if (!$this->mail->folderIsSelectable($folder))
{
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.": could not select folder $folder returning fake state");
$syncstate = "M:".'0'."-R:".'0'."-U:".'0'."-NUID:".'0'."-UIDV:".'0';
return array();
}
$this->mail->reopen($folder); $this->mail->reopen($folder);
if (!($status = $this->mail->getFolderStatus($folder,$ignoreStatusCache=true))) if (!($status = $this->mail->getFolderStatus($folder,$ignoreStatusCache=true)))
{ {
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.": could not stat folder $folder "); ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.": could not stat folder $folder ");
return false; return false;
} }
$syncstate = "M:". $status['messages'] ."-R:". $status['recent'] ."-U:". $status['unseen']."-NUID:".$status['uidnext']."-UIDV:".$status['uidvalidity']; $syncstate = "M:". $status['messages'] ."-R:". $status['recent'] ."-U:". $status['unseen']."-NUID:".$status['uidnext']."-UIDV:".$status['uidvalidity'];
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."($folderid, ...) $folder ($account) returning ".array2string($syncstate)); ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."($folderid, ...) $folder ($account) returning ".array2string($syncstate));