diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Folders.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Folders.php index c26547f15c..7b57f8c962 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Folders.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Folders.php @@ -16,6 +16,7 @@ use MailSo\Imap\FolderInformation; use MailSo\Imap\SequenceSet; use MailSo\Imap\Enumerations\FolderStatus; +use MailSo\Imap\Enumerations\FolderResponseStatus; /** * @category MailSo @@ -93,11 +94,23 @@ public function FolderRename(string $sOldFolderName, string $sNewFolderName) : s * @throws \MailSo\Net\Exceptions\Exception * @throws \MailSo\Imap\Exceptions\Exception */ - public function FolderStatus(string $sFolderName, array $aStatusItems) : ?array + public function FolderStatus(string $sFolderName) : FolderInformation { - if (!\count($aStatusItems)) { - return null; + $aStatusItems = array( + FolderResponseStatus::MESSAGES, + FolderResponseStatus::UNSEEN, + FolderResponseStatus::UIDNEXT + ); + if ($this->IsSupported('CONDSTORE')) { + $aStatusItems[] = FolderResponseStatus::HIGHESTMODSEQ; + } + if ($this->IsSupported('APPENDLIMIT')) { + $aStatusItems[] = FolderResponseStatus::APPENDLIMIT; } + if ($this->IsSupported('OBJECTID')) { + $aStatusItems[] = FolderResponseStatus::MAILBOXID; + } + $oFolderInfo = $this->oCurrentFolderInfo; $bReselect = false; $bWritable = false; @@ -129,7 +142,8 @@ public function FolderStatus(string $sFolderName, array $aStatusItems) : ?array if ($bReselect) { $this->selectOrExamineFolder($sFolderName, $bWritable, false); } - return $oInfo->getStatusItems(); + + return $oInfo; } /** diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php index 8903a7cf06..7163100f9e 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php @@ -413,23 +413,7 @@ public function MessageAppendFile(string $sMessageFileName, string $sFolderToSav protected function initFolderValues(string $sFolderName) : array { - $aTypes = array( - FolderResponseStatus::MESSAGES, - FolderResponseStatus::UNSEEN, - FolderResponseStatus::UIDNEXT - ); - - if ($this->oImapClient->IsSupported('CONDSTORE')) { - $aTypes[] = FolderResponseStatus::HIGHESTMODSEQ; - } - if ($this->oImapClient->IsSupported('APPENDLIMIT')) { - $aTypes[] = FolderResponseStatus::APPENDLIMIT; - } - if ($this->oImapClient->IsSupported('OBJECTID')) { - $aTypes[] = FolderResponseStatus::MAILBOXID; - } - - $aFolderStatus = $this->oImapClient->FolderStatus($sFolderName, $aTypes); + $aFolderStatus = $this->oImapClient->FolderStatus($sFolderName)->getStatusItems(); return [ \max(0, $aFolderStatus[FolderResponseStatus::MESSAGES] ?: 0), @@ -1246,7 +1230,7 @@ public function FolderDelete(string $sFolderFullName, bool $bUnsubscribeOnDeleti throw new \MailSo\Base\Exceptions\InvalidArgumentException; } - if ($this->IsSupported('IMAP4rev2')) { + if ($this->oImapClient->IsSupported('IMAP4rev2')) { $oInfo = $this->oImapClient->FolderExamine($sFolderFullName); } else { $oInfo = $this->oImapClient->FolderStatus($sFolderFullName);