mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 11:39:21 +03:00
Resolve #1230
This commit is contained in:
parent
83456164c7
commit
d6eb0d927a
3 changed files with 14 additions and 8 deletions
|
|
@ -384,14 +384,17 @@ trait Messages
|
|||
* @throws \MailSo\Net\Exceptions\*
|
||||
* @throws \MailSo\Imap\Exceptions\*
|
||||
*/
|
||||
public function MessageSimpleESearch(string $sSearchCriterias = 'ALL', array $aSearchReturn = null, bool $bReturnUid = true, string $sCharset = '', string $sLimit = '') : array
|
||||
public function MessageSimpleESearch(string $sSearchCriterias = 'ALL', array $aSearchReturn = null, bool $bReturnUid = true, string $sLimit = '') : array
|
||||
{
|
||||
$oESearch = new \MailSo\Imap\Requests\ESEARCH($this);
|
||||
$oESearch->sCriterias = $sSearchCriterias;
|
||||
$oESearch->aReturn = $aSearchReturn;
|
||||
$oESearch->bUid = $bReturnUid;
|
||||
$oESearch->sLimit = $sLimit;
|
||||
$oESearch->sCharset = $sCharset;
|
||||
// if (!$this->UTF8Mode() && !\mb_check_encoding($sSearchCriterias, 'UTF-8')) {
|
||||
if (!$this->UTF8Mode() && !\MailSo\Base\Utils::IsAscii($sSearchCriterias)) {
|
||||
$oESearch->sCharset = 'UTF-8';
|
||||
}
|
||||
$oESearch->SendRequest();
|
||||
return $this->getSimpleESearchOrESortResult($bReturnUid);
|
||||
}
|
||||
|
|
@ -420,12 +423,13 @@ trait Messages
|
|||
* @throws \MailSo\Net\Exceptions\*
|
||||
* @throws \MailSo\Imap\Exceptions\*
|
||||
*/
|
||||
public function MessageSimpleSearch(string $sSearchCriterias = 'ALL', bool $bReturnUid = true, string $sCharset = '') : array
|
||||
public function MessageSimpleSearch(string $sSearchCriterias = 'ALL', bool $bReturnUid = true) : array
|
||||
{
|
||||
$aRequest = array();
|
||||
if (\strlen($sCharset)) {
|
||||
// if (!$this->UTF8Mode() && !\mb_check_encoding($sSearchCriterias, 'UTF-8')) {
|
||||
if (!$this->UTF8Mode() && !\MailSo\Base\Utils::IsAscii($sSearchCriterias)) {
|
||||
$aRequest[] = 'CHARSET';
|
||||
$aRequest[] = \strtoupper($sCharset);
|
||||
$aRequest[] = 'UTF-8';
|
||||
}
|
||||
|
||||
$aRequest[] = !\strlen($sSearchCriterias) || '*' === $sSearchCriterias ? 'ALL' : $sSearchCriterias;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
|
||||
private bool $bIsLoggined = false;
|
||||
|
||||
/**
|
||||
* RFC 6855 UTF8 mode
|
||||
*/
|
||||
private bool $UTF8 = false;
|
||||
|
||||
public function Hash() : string
|
||||
|
|
@ -685,5 +688,4 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
{
|
||||
return $this->UTF8 ? $sText : \MailSo\Base\Utils::Utf7ModifiedToUtf8($sText);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -607,8 +607,8 @@ class MailClient
|
|||
$aResultUids = $this->oImapClient->MessageSimpleSort($aSortTypes, $sSearchCriterias, $bReturnUid);
|
||||
} else {
|
||||
// $this->oImapClient->hasCapability('ESEARCH')
|
||||
// $aResultUids = $this->oImapClient->MessageSimpleESearch($sSearchCriterias, null, $bReturnUid, \MailSo\Base\Utils::IsAscii($sSearchCriterias) ? '' : 'UTF-8')
|
||||
$aResultUids = $this->oImapClient->MessageSimpleSearch($sSearchCriterias, $bReturnUid, \MailSo\Base\Utils::IsAscii($sSearchCriterias) ? '' : 'UTF-8');
|
||||
// $aResultUids = $this->oImapClient->MessageSimpleESearch($sSearchCriterias, null, $bReturnUid)
|
||||
$aResultUids = $this->oImapClient->MessageSimpleSearch($sSearchCriterias, $bReturnUid);
|
||||
}
|
||||
|
||||
if ($bUseCacheAfterSearch) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue