mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-07 15:27:43 +08:00
Bugfix: Delete folder failed
This commit is contained in:
parent
9fea092c43
commit
a568c3f4f8
2 changed files with 20 additions and 22 deletions
|
@ -16,6 +16,7 @@ use MailSo\Imap\Folder;
|
|||
use MailSo\Imap\FolderInformation;
|
||||
use MailSo\Imap\SequenceSet;
|
||||
use MailSo\Imap\Enumerations\FolderStatus;
|
||||
use MailSo\Imap\Enumerations\FolderResponseStatus;
|
||||
|
||||
/**
|
||||
* @category MailSo
|
||||
|
@ -93,11 +94,23 @@ trait Folders
|
|||
* @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 @@ trait Folders
|
|||
if ($bReselect) {
|
||||
$this->selectOrExamineFolder($sFolderName, $bWritable, false);
|
||||
}
|
||||
return $oInfo->getStatusItems();
|
||||
|
||||
return $oInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -413,23 +413,7 @@ class MailClient
|
|||
|
||||
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 @@ class MailClient
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue