mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 22:17:03 +03:00
Fix gmail imap mails count
This commit is contained in:
parent
57221d9a8e
commit
348cb25dbc
10 changed files with 91 additions and 30 deletions
|
|
@ -692,13 +692,16 @@ class MailClient
|
|||
$sUidNext = isset($aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::UIDNEXT])
|
||||
? (string) $aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::UIDNEXT] : '0';
|
||||
|
||||
|
||||
if (0 === \strpos($sFolderName, '[Gmail]/'))
|
||||
if ($this->IsGmail())
|
||||
{
|
||||
$oFolder = $this->oImapClient->FolderCurrentInformation();
|
||||
if ($oFolder && null !== $oFolder->Exists)
|
||||
if ($oFolder && null !== $oFolder->Exists && $oFolder->FolderName === $sFolderName)
|
||||
{
|
||||
$iCount = (int) $oFolder->Exists;
|
||||
$iSubCount = (int) $oFolder->Exists;
|
||||
if (0 < $iSubCount && $iSubCount < $iCount)
|
||||
{
|
||||
$iCount = $iSubCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -802,9 +805,20 @@ class MailClient
|
|||
public function FolderInformation($sFolderName, $sPrevUidNext = '', $aUids = array())
|
||||
{
|
||||
$aFlags = array();
|
||||
if (\is_array($aUids) && 0 < \count($aUids))
|
||||
|
||||
$bSelect = false;
|
||||
if ($this->IsGmail())
|
||||
{
|
||||
$this->oImapClient->FolderExamine($sFolderName);
|
||||
$bSelect = true;
|
||||
}
|
||||
|
||||
if (\is_array($aUids) && 0 < \count($aUids))
|
||||
{
|
||||
if (!$bSelect)
|
||||
{
|
||||
$this->oImapClient->FolderExamine($sFolderName);
|
||||
}
|
||||
|
||||
$aFetchResponse = $this->oImapClient->Fetch(array(
|
||||
\MailSo\Imap\Enumerations\FetchType::INDEX,
|
||||
|
|
@ -863,6 +877,17 @@ class MailClient
|
|||
return self::GenerateHash($sFolderName, $iCount, $iUnseenCount, $sUidNext);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sSearch
|
||||
* @param bool $bDetectGmail = true
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function IsGmail()
|
||||
{
|
||||
return 'ssl://imap.gmail.com' === \strtolower($this->oImapClient->GetConnectedHost());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sSearch
|
||||
* @param bool $bDetectGmail = true
|
||||
|
|
@ -871,9 +896,8 @@ class MailClient
|
|||
*/
|
||||
private function escapeSearchString($sSearch, $bDetectGmail = true)
|
||||
{
|
||||
return ($bDetectGmail && !\MailSo\Base\Utils::IsAscii($sSearch) &&
|
||||
'ssl://imap.gmail.com' === \strtolower($this->oImapClient->GetConnectedHost()))
|
||||
? '{'.\strlen($sSearch).'+}'."\r\n".$sSearch : $this->oImapClient->EscapeString($sSearch);
|
||||
return ($bDetectGmail && !\MailSo\Base\Utils::IsAscii($sSearch) && $this->IsGmail())
|
||||
? '{'.\strlen($sSearch).'+}'."\r\n".$sSearch : $this->oImapClient->EscapeString($sSearch);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue