Improve previous bugfix commit with additional comments.

This commit is contained in:
djmaze 2021-10-27 21:49:44 +02:00
parent 3230a653d3
commit 2afb11fd65
2 changed files with 8 additions and 3 deletions

View file

@ -430,8 +430,12 @@ class ImapClient extends \MailSo\Net\NetClient
public function FolderStatus(string $sFolderName, array $aStatusItems) : ?array public function FolderStatus(string $sFolderName, array $aStatusItems) : ?array
{ {
$oFolderInfo = $this->oCurrentFolderInfo; $oFolderInfo = $this->oCurrentFolderInfo;
if ($sFolderName === $oFolderInfo->FolderName) { if ($oFolderInfo && $sFolderName === $oFolderInfo->FolderName) {
return $oFolderInfo->getStatusItems(); $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) return \count($aStatusItems)
? $this->SendRequestGetResponse('STATUS', array($this->EscapeString($sFolderName), $aStatusItems)) ? $this->SendRequestGetResponse('STATUS', array($this->EscapeString($sFolderName), $aStatusItems))
@ -1014,7 +1018,7 @@ class ImapClient extends \MailSo\Net\NetClient
return $this; return $this;
} }
public function FolderCurrentInformation() : FolderInformation public function FolderCurrentInformation() : ?FolderInformation
{ {
return $this->oCurrentFolderInfo; return $this->oCurrentFolderInfo;
} }

View file

@ -56,6 +56,7 @@ trait Status
* The number of messages which do not have the \Seen flag set. * 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, * 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. * but then it is the message sequence number of the first unseen message.
* However, Dovecot does return the amount of unseen messages
* @var int * @var int
*/ */
$UNSEEN, $UNSEEN,