From 30a6f7f94ac8f33c1dafd3608e08320402744557 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Wed, 14 Dec 2022 17:16:14 +0100 Subject: [PATCH] Cleanup Folders() fetch --- .../app/libraries/MailSo/Mail/MailClient.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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 ef5e6eac6..f26456c2a 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 @@ -911,13 +911,13 @@ class MailClient if ($this->oImapClient->IsSupported('LIST-EXTENDED')) { $bUseListSubscribeStatus = false; } else if ($bUseListSubscribeStatus) { - //\SnappyMail\Log::warning('IMAP', 'RFC5258 not supported, using LSUB'); +// $this->oLogger && $this->oLogger->Write('RFC5258 not supported, using LSUB'); +// \SnappyMail\Log::warning('IMAP', 'RFC5258 not supported, using LSUB'); try { $aSubscribedFolders = $this->oImapClient->FolderSubscribeList($sParent, $sListPattern); $aImapSubscribedFoldersHelper = array(); - foreach ($aSubscribedFolders as /* @var $oImapFolder \MailSo\Imap\Folder */ $oImapFolder) - { + foreach ($aSubscribedFolders as /* @var $oImapFolder \MailSo\Imap\Folder */ $oImapFolder) { $aImapSubscribedFoldersHelper[] = $oImapFolder->FullName(); } } @@ -937,19 +937,18 @@ class MailClient if (($bUseListSubscribeStatus && (null === $aImapSubscribedFoldersHelper || \in_array($sFullName, $aImapSubscribedFoldersHelper))) || $oImapFolder->IsInbox()) { $oImapFolder->setSubscribed(); } - $aFolders[$sFullName] = $oImapFolder; // Add NonExistent folders $sDelimiter = $oImapFolder->Delimiter(); $aFolderExplode = \explode($sDelimiter, $sFullName); \array_pop($aFolderExplode); while ($aFolderExplode) { - $sNonExistentFolderFullName = \implode($sDelimiter, $aFolderExplode); - if (!isset($aFolders[$sNonExistentFolderFullName])) { + $sFullName = \implode($sDelimiter, $aFolderExplode); + if (!isset($aFolders[$sFullName])) { try { - $aFolders[$sNonExistentFolderFullName] = - new \MailSo\Imap\Folder($sNonExistentFolderFullName, $sDelimiter, ['\\Noselect', '\\NonExistent']); + $aFolders[$sFullName] = + new \MailSo\Imap\Folder($sFullName, $sDelimiter, ['\\Noselect', '\\NonExistent']); } catch (\Throwable $oExc) {