diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Messages.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Messages.php index 849397361..2ac360957 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Messages.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Messages.php @@ -42,7 +42,6 @@ trait Messages $this->aFetchCallbacks = array(); try { $aFetchItems = array( - FetchType::INDEX, FetchType::UID, FetchType::RFC822_SIZE ); @@ -50,14 +49,19 @@ trait Messages { switch ($mFetchKey) { - case FetchType::INDEX: case FetchType::UID: case FetchType::RFC822_SIZE: // Already defined by default break; + // Macro's + case FetchType::FULL: + $aFetchItems[] = FetchType::BODY; + // Falls through case FetchType::ALL: $aFetchItems[] = FetchType::ENVELOPE; + // Falls through + case FetchType::FAST: $aFetchItems[] = FetchType::FLAGS; $aFetchItems[] = FetchType::INTERNALDATE; break; diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FetchType.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FetchType.php index 3f247b4c1..01cdff93f 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FetchType.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FetchType.php @@ -18,7 +18,13 @@ namespace MailSo\Imap\Enumerations; */ abstract class FetchType { + // Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE) + const FAST = 'FAST'; + // Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE) const ALL = 'ALL'; + // Macro equivalent to: (FLAGS INTERNALDATE RFC822.SIZE ENVELOPE BODY) + const FULL = 'FULL'; + const BODY = 'BODY'; const BODY_PEEK = 'BODY.PEEK'; const BODY_HEADER = 'BODY[HEADER]'; @@ -32,7 +38,6 @@ abstract class FetchType const RFC822_SIZE = 'RFC822.SIZE'; const RFC822_TEXT = 'RFC822.TEXT'; const UID = 'UID'; - const INDEX = 'INDEX'; // RFC 3516 const BINARY = 'BINARY'; const BINARY_PEEK = 'BINARY.PEEK'; diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/FetchResponse.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/FetchResponse.php index bef220f32..9735bbaff 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/FetchResponse.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/FetchResponse.php @@ -105,10 +105,6 @@ class FetchResponse */ public function GetFetchValue(string $sFetchItemName) { - if (Enumerations\FetchType::INDEX === $sFetchItemName) { - return $this->oImapResponse->ResponseList[1]; - } - if (isset($this->oImapResponse->ResponseList[3]) && \is_array($this->oImapResponse->ResponseList[3])) { $bNextIsValue = false; foreach ($this->oImapResponse->ResponseList[3] as $mItem) { 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 2563a6172..8903a7cf0 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 @@ -157,7 +157,6 @@ class MailClient $oMessage = null; $aFetchItems = array( - FetchType::INDEX, FetchType::UID, FetchType::RFC822_SIZE, FetchType::INTERNALDATE, @@ -477,7 +476,6 @@ class MailClient $this->oImapClient->FolderExamine($sFolderName); $aFetchResponse = $this->oImapClient->Fetch(array( - FetchType::INDEX, FetchType::UID, FetchType::FLAGS, FetchType::BuildBodyCustomHeaderRequest(array( @@ -533,7 +531,6 @@ class MailClient $this->oImapClient->FolderExamine($sFolderName); $aFetchResponse = $this->oImapClient->Fetch(array( - FetchType::INDEX, FetchType::UID, FetchType::FLAGS ), (string) $oRange, $oRange->UID); @@ -667,7 +664,6 @@ class MailClient if (\count($oRange)) { $aFetchResponse = $this->oImapClient->Fetch(array( - FetchType::INDEX, FetchType::UID, FetchType::RFC822_SIZE, FetchType::INTERNALDATE, @@ -679,9 +675,10 @@ class MailClient if (\count($aFetchResponse)) { $aCollection = \array_fill_keys($oRange->getArrayCopy(), null); - $sFetchType = $oRange->UID ? FetchType::UID : FetchType::INDEX; foreach ($aFetchResponse as /* @var $oFetchResponseItem \MailSo\Imap\FetchResponse */ $oFetchResponseItem) { - $id = $oFetchResponseItem->GetFetchValue($sFetchType); + $id = $oRange->UID + ? $oFetchResponseItem->GetFetchValue(FetchType::UID) + : $this->oImapResponse->ResponseList[1]; $aCollection[$id] = Message::NewFetchResponseInstance($oMessageCollection->FolderName, $oFetchResponseItem); } $oMessageCollection->exchangeArray(\array_values(\array_filter($aCollection)));