MessageExpunge should be FolderExpunge

And simplify the function parameters
This commit is contained in:
djmaze 2022-01-06 11:00:56 +01:00
parent e31b4f4b75
commit 7dec51a364
2 changed files with 10 additions and 10 deletions

View file

@ -944,20 +944,20 @@ class ImapClient extends \MailSo\Net\NetClient
} }
/** /**
* The EXPUNGE command permanently removes all messages that have the
* \Deleted flag set from the currently selected mailbox.
*
* @throws \MailSo\Net\Exceptions\Exception * @throws \MailSo\Net\Exceptions\Exception
* @throws \MailSo\Imap\Exceptions\Exception * @throws \MailSo\Imap\Exceptions\Exception
*/ */
public function MessageExpunge(string $sUidRangeIfSupported = '', bool $bForceUidExpunge = false, bool $bExpungeAll = false) : self public function FolderExpunge(SequenceSet $oUidRange = null) : self
{ {
$sUidRangeIfSupported = \trim($sUidRangeIfSupported);
$sCmd = 'EXPUNGE'; $sCmd = 'EXPUNGE';
$aArguments = array(); $aArguments = array();
if (!$bExpungeAll && $bForceUidExpunge && \strlen($sUidRangeIfSupported) && $this->IsSupported('UIDPLUS')) if ($oUidRange && \count($oUidRange) && $oRange->UID && $this->IsSupported('UIDPLUS')) {
{
$sCmd = 'UID '.$sCmd; $sCmd = 'UID '.$sCmd;
$aArguments = array($sUidRangeIfSupported); $aArguments = array((string) $oUidRange);
} }
$this->SendRequestGetResponse($sCmd, $aArguments); $this->SendRequestGetResponse($sCmd, $aArguments);

View file

@ -390,10 +390,10 @@ class MailClient
StoreAction::ADD_FLAGS_SILENT StoreAction::ADD_FLAGS_SILENT
); );
if ($oRange->UID) { if ($bExpungeAll) {
$this->oImapClient->MessageExpunge((string) $oRange, true, $bExpungeAll); $this->oImapClient->FolderExpunge();
} else { } else {
$this->oImapClient->MessageExpunge('', false, $bExpungeAll); $this->oImapClient->FolderExpunge($oRange);
} }
return $this; return $this;
@ -1390,7 +1390,7 @@ class MailClient
StoreAction::ADD_FLAGS_SILENT StoreAction::ADD_FLAGS_SILENT
); );
$this->oImapClient->MessageExpunge(); $this->oImapClient->FolderExpunge();
} }
return $this; return $this;