mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +03:00
Better fix for #179
As RFC 5256 says: The US-ASCII and UTF-8 charsets MUST be implemented. So just use UTF-8
This commit is contained in:
parent
5e4821fef8
commit
46317b5007
5 changed files with 9 additions and 32 deletions
|
|
@ -138,11 +138,10 @@ trait Messages
|
|||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Imap\Exceptions\Exception
|
||||
*/
|
||||
public function MessageSimpleThread(string $sSearchCriterias = 'ALL', bool $bReturnUid = true, string $sCharset = \MailSo\Base\Enumerations\Charset::UTF_8) : array
|
||||
public function MessageSimpleThread(string $sSearchCriterias = 'ALL', bool $bReturnUid = true) : array
|
||||
{
|
||||
$oThread = new \MailSo\Imap\Requests\THREAD($this);
|
||||
$oThread->sCriterias = $sSearchCriterias;
|
||||
$oThread->sCharset = $sCharset;
|
||||
$oThread->bUid = $bReturnUid;
|
||||
return $oThread->SendRequestGetResponse();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1321,9 +1321,4 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
return $this->UTF8 ? $sText : \MailSo\Base\Utils::Utf7ModifiedToUtf8($sText);
|
||||
}
|
||||
|
||||
public function isUTF8() : bool
|
||||
{
|
||||
return $this->UTF8;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,15 +96,9 @@ class SORT extends Request
|
|||
|
||||
$aRequest[] = $this->aSortTypes;
|
||||
|
||||
$sSearchCriterias = (\strlen($this->sCriterias) && '*' !== $this->sCriterias) ? $this->sCriterias : 'ALL';
|
||||
$aRequest[] = 'UTF-8'; // \strtoupper(\MailSo\Base\Enumerations\Charset::UTF_8)
|
||||
|
||||
if (!$this->sCharset) {
|
||||
$this->sCharset = (!$this->oImapClient->isUTF8() && \MailSo\Base\Utils::IsAscii($sSearchCriterias))
|
||||
? 'US-ASCII' : 'UTF-8';
|
||||
}
|
||||
|
||||
$aRequest[] = \strtoupper($this->sCharset);
|
||||
$aRequest[] = $sSearchCriterias;
|
||||
$aRequest[] = (\strlen($this->sCriterias) && '*' !== $this->sCriterias) ? $this->sCriterias : 'ALL';
|
||||
|
||||
if (\strlen($this->sLimit)) {
|
||||
$aRequest[] = $this->sLimit;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ class THREAD extends Request
|
|||
public
|
||||
$sAlgorithm = '', // ORDEREDSUBJECT or REFERENCES or REFS
|
||||
$sCriterias = 'ALL',
|
||||
$sCharset = '',
|
||||
$bUid = true;
|
||||
|
||||
function __construct(\MailSo\Imap\ImapClient $oImapClient)
|
||||
|
|
@ -50,23 +49,13 @@ class THREAD extends Request
|
|||
\MailSo\Log\Enumerations\Type::ERROR, true);
|
||||
}
|
||||
|
||||
$aRequest = array(
|
||||
$this->sAlgorithm
|
||||
);
|
||||
|
||||
$sSearchCriterias = (\strlen($this->sCriterias) && '*' !== $this->sCriterias) ? $this->sCriterias : 'ALL';
|
||||
|
||||
if (!$this->sCharset) {
|
||||
$this->sCharset = (!$this->oImapClient->isUTF8() && \MailSo\Base\Utils::IsAscii($sSearchCriterias))
|
||||
? 'US-ASCII' : 'UTF-8';
|
||||
}
|
||||
|
||||
$aRequest[] = \strtoupper($this->sCharset);
|
||||
$aRequest[] = $sSearchCriterias;
|
||||
|
||||
$this->oImapClient->SendRequest(
|
||||
($this->bUid ? 'UID THREAD' : 'THREAD'),
|
||||
$aRequest
|
||||
array(
|
||||
$this->sAlgorithm,
|
||||
'UTF-8', // \strtoupper(\MailSo\Base\Enumerations\Charset::UTF_8)
|
||||
(\strlen($this->sCriterias) && '*' !== $this->sCriterias) ? $this->sCriterias : 'ALL'
|
||||
)
|
||||
);
|
||||
|
||||
$aReturn = array();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace MailSo\Imap;
|
|||
* @category MailSo
|
||||
* @package Mail
|
||||
*/
|
||||
class SearchCriterias
|
||||
abstract class SearchCriterias
|
||||
{
|
||||
const
|
||||
RegEx = 'in|e?mail|from|to|subject|has|is|date|text|body|size|larger|bigger|smaller|maxsize|minsize';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue