mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-02-25 07:16:21 +08:00
Bugfix: there's a long standing IMAP CLIENTBUG where STATUS command is executed after SELECT/EXAMINE on same folder
This commit is contained in:
parent
a7194b74b9
commit
3230a653d3
2 changed files with 14 additions and 11 deletions
|
@ -429,6 +429,10 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
*/
|
||||
public function FolderStatus(string $sFolderName, array $aStatusItems) : ?array
|
||||
{
|
||||
$oFolderInfo = $this->oCurrentFolderInfo;
|
||||
if ($sFolderName === $oFolderInfo->FolderName) {
|
||||
return $oFolderInfo->getStatusItems();
|
||||
}
|
||||
return \count($aStatusItems)
|
||||
? $this->SendRequestGetResponse('STATUS', array($this->EscapeString($sFolderName), $aStatusItems))
|
||||
->getStatusFolderInformationResult()
|
||||
|
@ -735,6 +739,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
|
||||
if (!$aSearchOrSortReturn)
|
||||
{
|
||||
// ALL OR COUNT | MIN | MAX
|
||||
$aSearchOrSortReturn = array('ALL');
|
||||
}
|
||||
|
||||
|
@ -1039,6 +1044,8 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
$sFakeCommand = $sTag.' '.$sCommand.$this->prepareParamLine($aFakeParams);
|
||||
}
|
||||
|
||||
// $this->lastCommand = $sFakeCommand ?: $sRealCommand;
|
||||
|
||||
$this->aTagTimeouts[$sTag] = \microtime(true);
|
||||
|
||||
if ($bBreakOnLiteral && !\preg_match('/\d\+\}\r\n/', $sRealCommand))
|
||||
|
@ -1123,6 +1130,12 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
throw new Exceptions\ResponseNotFoundException;
|
||||
}
|
||||
|
||||
// RFC 5530
|
||||
if (\is_array($oResponse->OptionalResponse) && 'CLIENTBUG' === $oResponse->OptionalResponse[0]) {
|
||||
// The server has detected a client bug.
|
||||
// \error_log("IMAP {$oResponse->OptionalResponse[0]}: {$this->lastCommand}");
|
||||
}
|
||||
|
||||
$oResult->append($oResponse);
|
||||
if ($sEndTag === $oResponse->Tag || Enumerations\ResponseType::CONTINUATION === $oResponse->ResponseType) {
|
||||
if (isset($this->aTagTimeouts[$sEndTag])) {
|
||||
|
@ -1134,11 +1147,6 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
// RFC 5530
|
||||
if (\is_array($oResponse->OptionalResponse) && 'CLIENTBUG' === $oResponse->OptionalResponse[0]) {
|
||||
// The server has detected a client bug.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -630,14 +630,9 @@ class MailClient
|
|||
{
|
||||
$aFlags = array();
|
||||
|
||||
$bSelect = false;
|
||||
|
||||
if (\count($aUids))
|
||||
{
|
||||
if (!$bSelect)
|
||||
{
|
||||
$this->oImapClient->FolderSelect($sFolderName);
|
||||
}
|
||||
$this->oImapClient->FolderSelect($sFolderName);
|
||||
|
||||
$aFetchResponse = $this->oImapClient->Fetch(array(
|
||||
\MailSo\Imap\Enumerations\FetchType::INDEX,
|
||||
|
|
Loading…
Reference in a new issue