From dbc31d5ccb1190d2307b413c3ab9aff219e629d1 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 25 Oct 2016 11:39:23 +0000 Subject: [PATCH] fix problem with AlterPingChanges with non selectable folders --- mail/inc/class.mail_zpush.inc.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mail/inc/class.mail_zpush.inc.php b/mail/inc/class.mail_zpush.inc.php index 83c383f4fb..79e831abdc 100644 --- a/mail/inc/class.mail_zpush.inc.php +++ b/mail/inc/class.mail_zpush.inc.php @@ -1783,14 +1783,20 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail, if ($type != 'mail') return false; 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))) { - ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.": could not stat folder $folder "); - return false; - } + ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.": could not stat folder $folder "); + return false; + } $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));