Skip to content

Commit

Permalink
Bugfix: Delete folder failed
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Jan 12, 2022
1 parent 9fea092 commit a568c3f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
22 changes: 18 additions & 4 deletions snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Folders.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use MailSo\Imap\FolderInformation;
use MailSo\Imap\SequenceSet;
use MailSo\Imap\Enumerations\FolderStatus;
use MailSo\Imap\Enumerations\FolderResponseStatus;

/**
* @category MailSo
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -129,7 +142,8 @@ public function FolderStatus(string $sFolderName, array $aStatusItems) : ?array
if ($bReselect) {
$this->selectOrExamineFolder($sFolderName, $bWritable, false);
}
return $oInfo->getStatusItems();

return $oInfo;
}

/**
Expand Down
20 changes: 2 additions & 18 deletions snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a568c3f

Please sign in to comment.