Put RFC 6855 draft code in

This commit is contained in:
djmaze 2021-11-21 20:42:31 +01:00
parent 97348be6c9
commit c9a497eb9d
2 changed files with 16 additions and 5 deletions

View file

@ -244,10 +244,14 @@ class ImapClient extends \MailSo\Net\NetClient
$this->SendRequestGetResponse('PROXYAUTH', array($this->EscapeString($sProxyAuthUser))); $this->SendRequestGetResponse('PROXYAUTH', array($this->EscapeString($sProxyAuthUser)));
} }
/* /*
// RFC 9051 // TODO: RFC 9051
if ($this->IsSupported('IMAP4rev2')) { if ($this->IsSupported('IMAP4rev2')) {
$this->SendRequestGetResponse('ENABLE', array('IMAP4rev1')); $this->SendRequestGetResponse('ENABLE', array('IMAP4rev1'));
} }
// TODO: RFC 6855
if ($this->IsSupported('UTF8=ONLY')) {
$this->SendRequestGetResponse('ENABLE', array('UTF8=ACCEPT'));
}
*/ */
} }
catch (Exceptions\NegativeResponseException $oException) catch (Exceptions\NegativeResponseException $oException)
@ -1107,13 +1111,14 @@ class ImapClient extends \MailSo\Net\NetClient
try { try {
if (\is_resource($this->ConnectionResource())) { if (\is_resource($this->ConnectionResource())) {
\SnappyMail\HTTP\Stream::start(); \SnappyMail\HTTP\Stream::start();
$sEndTag = $sEndTag ?: $this->getCurrentTag(); $sEndTag = ($sEndTag ?: $this->getCurrentTag()) . ' ';
$sLine = \fgets($this->ConnectionResource()); $sLine = \fgets($this->ConnectionResource());
do { do {
echo $sLine; if (\str_starts_with($sLine, $sEndTag)) {
if (0 === \strpos($sLine, $sEndTag)) { echo 'T '.\substr($sLine, \strlen($sEndTag));
break; break;
} }
echo $sLine;
$sLine = \fgets($this->ConnectionResource()); $sLine = \fgets($this->ConnectionResource());
} while (\strlen($sLine)); } while (\strlen($sLine));
exit; exit;

View file

@ -21,7 +21,13 @@ if (defined('APP_VERSION'))
if (!function_exists('str_contains')) { if (!function_exists('str_contains')) {
function str_contains(string $haystack, string $needle) : bool function str_contains(string $haystack, string $needle) : bool
{ {
return false !== \strpos($haystack, $needle); return false !== strpos($haystack, $needle);
}
}
if (!function_exists('str_starts_with')) {
function str_starts_with(string $haystack, string $needle) : bool
{
return 0 === strncmp($haystack, $needle, strlen($needle));
} }
} }