From a426330dca231aa77f7732073dd3c6cdb2c86b40 Mon Sep 17 00:00:00 2001 From: djmaze <> Date: Fri, 7 Jan 2022 13:50:37 +0100 Subject: [PATCH] IMAP GETMETADATA use yieldUntaggedResponses() --- .../MailSo/Imap/Commands/Metadata.php | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Metadata.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Metadata.php index 4bbae0a06..f0246a18d 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Metadata.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Metadata.php @@ -33,13 +33,12 @@ trait Metadata $this->EscapeString('*') ]; $arguments[] = '(' . \implode(' ', \array_map([$this, 'EscapeString'], ['/shared', '/private'])) . ')'; - $oResult = $this->SendRequestGetResponse('GETMETADATA', $arguments); - foreach ($oResult as $oResponse) { - if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oResponse->ResponseType - && 4 === \count($oResponse->ResponseList) + $this->SendRequest('GETMETADATA', $arguments); + foreach ($this->yieldUntaggedResponses() as $oResponse) { + if (isset($oResponse->ResponseList[3]) + && \is_array($oResponse->ResponseList[3]) && 'METADATA' === $oResponse->ResponseList[1] - && \is_array($oResponse->ResponseList[3])) - { + ) { $aMetadata = array(); $c = \count($oResponse->ResponseList[3]); for ($i = 0; $i < $c; $i += 2) { @@ -79,15 +78,13 @@ trait Metadata $arguments[] = '(' . \implode(' ', \array_map([$this, 'EscapeString'], $aEntries)) . ')'; - $oResult = $this->SendRequestGetResponse('GETMETADATA', $arguments); - $aReturn = array(); - foreach ($oResult as $oResponse) { - if (\MailSo\Imap\Enumerations\ResponseType::UNTAGGED === $oResponse->ResponseType - && 4 === \count($oResponse->ResponseList) + $this->SendRequest('GETMETADATA', $arguments); + foreach ($this->yieldUntaggedResponses() as $oResponse) { + if (isset($oResponse->ResponseList[3]) + && \is_array($oResponse->ResponseList[3]) && 'METADATA' === $oResponse->ResponseList[1] - && \is_array($oResponse->ResponseList[3])) - { + ) { $c = \count($oResponse->ResponseList[3]); for ($i = 0; $i < $c; $i += 2) { $aReturn[$oResponse->ResponseList[3][$i]] = $oResponse->ResponseList[3][$i+1];