From 7dec51a3647ef2c1c4be7f899571a3039631caad Mon Sep 17 00:00:00 2001 From: djmaze <> Date: Thu, 6 Jan 2022 11:00:56 +0100 Subject: [PATCH] MessageExpunge should be FolderExpunge And simplify the function parameters --- .../v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php | 12 ++++++------ .../v/0.0.0/app/libraries/MailSo/Mail/MailClient.php | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php index 083a32490..c74898945 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php @@ -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\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'; $aArguments = array(); - if (!$bExpungeAll && $bForceUidExpunge && \strlen($sUidRangeIfSupported) && $this->IsSupported('UIDPLUS')) - { + if ($oUidRange && \count($oUidRange) && $oRange->UID && $this->IsSupported('UIDPLUS')) { $sCmd = 'UID '.$sCmd; - $aArguments = array($sUidRangeIfSupported); + $aArguments = array((string) $oUidRange); } $this->SendRequestGetResponse($sCmd, $aArguments); 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 cee72a26c..9d3a63b9c 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 @@ -390,10 +390,10 @@ class MailClient StoreAction::ADD_FLAGS_SILENT ); - if ($oRange->UID) { - $this->oImapClient->MessageExpunge((string) $oRange, true, $bExpungeAll); + if ($bExpungeAll) { + $this->oImapClient->FolderExpunge(); } else { - $this->oImapClient->MessageExpunge('', false, $bExpungeAll); + $this->oImapClient->FolderExpunge($oRange); } return $this; @@ -1390,7 +1390,7 @@ class MailClient StoreAction::ADD_FLAGS_SILENT ); - $this->oImapClient->MessageExpunge(); + $this->oImapClient->FolderExpunge(); } return $this;