From 2afb11fd65f87358bb18099ae6c05e6bf194c811 Mon Sep 17 00:00:00 2001 From: djmaze Date: Wed, 27 Oct 2021 21:49:44 +0200 Subject: [PATCH] Improve previous bugfix commit with additional comments. --- .../v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php | 10 +++++++--- .../0.0.0/app/libraries/MailSo/Imap/Traits/Status.php | 1 + 2 files changed, 8 insertions(+), 3 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 20c9a0f0d..ec70f5517 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 @@ -430,8 +430,12 @@ class ImapClient extends \MailSo\Net\NetClient public function FolderStatus(string $sFolderName, array $aStatusItems) : ?array { $oFolderInfo = $this->oCurrentFolderInfo; - if ($sFolderName === $oFolderInfo->FolderName) { - return $oFolderInfo->getStatusItems(); + if ($oFolderInfo && $sFolderName === $oFolderInfo->FolderName) { + $aResult = $oFolderInfo->getStatusItems(); + // SELECT or EXAMINE command then UNSEEN is the message sequence number of the first unseen message + // However, Dovecot does return the amount of unseen messages +// $aResult['UNSEEN'] = $this->simpleESearchOrESortHelper(false, 'UNSEEN', ['COUNT'])['COUNT']; + return $aResult; } return \count($aStatusItems) ? $this->SendRequestGetResponse('STATUS', array($this->EscapeString($sFolderName), $aStatusItems)) @@ -1014,7 +1018,7 @@ class ImapClient extends \MailSo\Net\NetClient return $this; } - public function FolderCurrentInformation() : FolderInformation + public function FolderCurrentInformation() : ?FolderInformation { return $this->oCurrentFolderInfo; } diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/Status.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/Status.php index d517b474b..11927d98c 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/Status.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/Status.php @@ -56,6 +56,7 @@ trait Status * The number of messages which do not have the \Seen flag set. * This response also occurs as a result of a SELECT or EXAMINE command, * but then it is the message sequence number of the first unseen message. + * However, Dovecot does return the amount of unseen messages * @var int */ $UNSEEN,