From c9a497eb9de97c63fdf238984f427f12f12395e9 Mon Sep 17 00:00:00 2001 From: djmaze Date: Sun, 21 Nov 2021 20:42:31 +0100 Subject: [PATCH] Put RFC 6855 draft code in --- .../0.0.0/app/libraries/MailSo/Imap/ImapClient.php | 13 +++++++++---- snappymail/v/0.0.0/include.php | 8 +++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php index c421bec65..e71e23ca3 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php @@ -244,10 +244,14 @@ class ImapClient extends \MailSo\Net\NetClient $this->SendRequestGetResponse('PROXYAUTH', array($this->EscapeString($sProxyAuthUser))); } /* - // RFC 9051 + // TODO: RFC 9051 if ($this->IsSupported('IMAP4rev2')) { $this->SendRequestGetResponse('ENABLE', array('IMAP4rev1')); } + // TODO: RFC 6855 + if ($this->IsSupported('UTF8=ONLY')) { + $this->SendRequestGetResponse('ENABLE', array('UTF8=ACCEPT')); + } */ } catch (Exceptions\NegativeResponseException $oException) @@ -1107,13 +1111,14 @@ class ImapClient extends \MailSo\Net\NetClient try { if (\is_resource($this->ConnectionResource())) { \SnappyMail\HTTP\Stream::start(); - $sEndTag = $sEndTag ?: $this->getCurrentTag(); + $sEndTag = ($sEndTag ?: $this->getCurrentTag()) . ' '; $sLine = \fgets($this->ConnectionResource()); do { - echo $sLine; - if (0 === \strpos($sLine, $sEndTag)) { + if (\str_starts_with($sLine, $sEndTag)) { + echo 'T '.\substr($sLine, \strlen($sEndTag)); break; } + echo $sLine; $sLine = \fgets($this->ConnectionResource()); } while (\strlen($sLine)); exit; diff --git a/snappymail/v/0.0.0/include.php b/snappymail/v/0.0.0/include.php index 7f94e9c3c..4a473015a 100644 --- a/snappymail/v/0.0.0/include.php +++ b/snappymail/v/0.0.0/include.php @@ -21,7 +21,13 @@ if (defined('APP_VERSION')) if (!function_exists('str_contains')) { 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)); } }