diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Base/DateTimeHelper.php b/snappymail/v/0.0.0/app/libraries/MailSo/Base/DateTimeHelper.php index ae34f5236..6d642a188 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Base/DateTimeHelper.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Base/DateTimeHelper.php @@ -32,7 +32,7 @@ abstract class DateTimeHelper /** * Parse date string formated as "Thu, 10 Jun 2010 08:58:33 -0700 (PDT)" - * RFC2822 + * RFC 2822 */ public static function ParseRFC2822DateString(string $sDateTime) : int { diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Folders.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Folders.php index 7b57f8c96..d791ba5f2 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Folders.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Folders.php @@ -31,8 +31,10 @@ trait Folders */ public function FolderCreate(string $sFolderName) : self { - $this->SendRequestGetResponse('CREATE', - array($this->EscapeFolderName($sFolderName))); + $this->SendRequestGetResponse('CREATE', array( + $this->EscapeFolderName($sFolderName) +// , ['(USE (\Drafts \Sent))'] RFC 6154 + )); return $this; } @@ -163,13 +165,15 @@ trait Folders * @throws \MailSo\Net\Exceptions\Exception * @throws \MailSo\Imap\Exceptions\Exception */ - public function FolderClose() : self + public function FolderClose() : int { if ($this->IsSelected()) { $this->SendRequestGetResponse('CLOSE'); $this->oCurrentFolderInfo = null; + // https://datatracker.ietf.org/doc/html/rfc5162#section-3.4 + // return HIGHESTMODSEQ ? } - return $this; + return 0; } /** @@ -204,7 +208,7 @@ trait Folders * @throws \MailSo\Net\Exceptions\Exception * @throws \MailSo\Imap\Exceptions\Exception */ - public function FolderExpunge(SequenceSet $oUidRange = null) : self + public function FolderExpunge(SequenceSet $oUidRange = null) : void { $sCmd = 'EXPUNGE'; $aArguments = array(); @@ -214,8 +218,11 @@ trait Folders $aArguments = array((string) $oUidRange); } + // https://datatracker.ietf.org/doc/html/rfc5162#section-3.5 + // Before returning an OK to the client, those messages that are removed + // are reported using a VANISHED response or EXPUNGE responses. + $this->SendRequestGetResponse($sCmd, $aArguments); - return $this; } /** @@ -274,10 +281,24 @@ trait Folders } $aSelectParams = array(); + /* + // RFC 5162 + if ($this->IsSupported('QRESYNC')) { + $this->Enable(['QRESYNC', 'CONDSTORE']); + - the last known UIDVALIDITY, + - the last known modification sequence, + - the optional set of known UIDs, + - and an optional parenthesized list of known sequence ranges and their corresponding UIDs. + QRESYNC (UIDVALIDITY HIGHESTMODSEQ 41,43:211,214:541) + QRESYNC (67890007 20050715194045000 41,43:211,214:541) + } + + // RFC 4551 if ($this->IsSupported('CONDSTORE')) { $aSelectParams[] = 'CONDSTORE'; } + // RFC 5738 if ($this->UTF8) { $aSelectParams[] = 'UTF8'; diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Messages.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Messages.php index 2ac360957..99f2f3789 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Messages.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Commands/Messages.php @@ -88,6 +88,8 @@ trait Messages * $aParams[] = (CHANGEDSINCE $modsequence) * https://datatracker.ietf.org/doc/html/rfc4551#section-3.3.2 * $aParams[1][] = MODSEQ + * https://datatracker.ietf.org/doc/html/rfc5162#section-3.2 + * $bIndexIsUid && $aParams[] = (CHANGEDSINCE $modsequence VANISHED) */ $this->SendRequest($bIndexIsUid ? 'UID FETCH' : 'FETCH', $aParams); @@ -150,6 +152,11 @@ trait Messages return $iUid; } + /** + * RFC 3502 MULTIAPPEND + public function MessageAppendStreams(string $sFolderName, $rMessageAppendStream, int $iStreamSize, array $aAppendFlags = null, int &$iUid = null, int $iDateTime = 0) : ?int + */ + /** * @throws \MailSo\Base\Exceptions\InvalidArgumentException * @throws \MailSo\Net\Exceptions\Exception diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderACL.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderACL.php index ccacd424d..154b07393 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderACL.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderACL.php @@ -28,7 +28,7 @@ enum FolderACL: string { abstract class FolderACL { const - /** rfc2086 */ + /** RFC 2086 */ // perform SETACL/DELETEACL/GETACL/LISTRIGHTS ADMINISTER = 'a', // mailbox is visible to LIST/LSUB commands, SUBSCRIBE mailbox @@ -47,7 +47,7 @@ abstract class FolderACL // CREATE_OLD = 'c', // STORE DELETED flag, perform EXPUNGE // DELETED_OLD = 'd', - /** rfc4314 */ + /** RFC 4314 */ // CREATE new sub-mailboxes in any implementation-defined hierarchy, parent mailbox for the new mailbox name in RENAME CREATE = 'k', // DELETE mailbox, old mailbox name in RENAME diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderResponseStatus.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderResponseStatus.php index f6259eb69..6377e96f9 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderResponseStatus.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderResponseStatus.php @@ -18,16 +18,16 @@ namespace MailSo\Imap\Enumerations; */ abstract class FolderResponseStatus { - // rfc3501 + // RFC 3501 const MESSAGES = 'MESSAGES'; // const RECENT = 'RECENT'; // IMAP4rev2 deprecated const UIDNEXT = 'UIDNEXT'; const UIDVALIDITY = 'UIDVALIDITY'; const UNSEEN = 'UNSEEN'; - // rfc4551 + // RFC 4551 const HIGHESTMODSEQ = 'HIGHESTMODSEQ'; - // rfc7889 + // RFC 7889 const APPENDLIMIT = 'APPENDLIMIT'; - // rfc8474 + // RFC 8474 const MAILBOXID = 'MAILBOXID'; } diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderStatus.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderStatus.php index 2b827f1d5..a651fad9b 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderStatus.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderStatus.php @@ -18,16 +18,16 @@ namespace MailSo\Imap\Enumerations; */ abstract class FolderStatus { - // rfc3501 + // RFC 3501 const MESSAGES = 'MESSAGES'; // const RECENT = 'RECENT'; // IMAP4rev2 deprecated const UIDNEXT = 'UIDNEXT'; const UIDVALIDITY = 'UIDVALIDITY'; const UNSEEN = 'UNSEEN'; - // rfc4551 + // RFC 4551 const HIGHESTMODSEQ = 'HIGHESTMODSEQ'; - // rfc7889 + // RFC 7889 const APPENDLIMIT = 'APPENDLIMIT'; - // rfc8474 + // RFC 8474 const MAILBOXID = 'MAILBOXID'; } 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 3f10afe4a..e55ab992c 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 @@ -234,13 +234,13 @@ class ImapClient extends \MailSo\Net\NetClient /* // TODO: RFC 9051 if ($this->IsSupported('IMAP4rev2')) { - $this->SendRequestGetResponse('ENABLE', array('IMAP4rev1')); + $this->Enable('IMAP4rev1'); } */ // RFC 6855 || RFC 5738 $this->UTF8 = $this->IsSupported('UTF8=ONLY') || $this->IsSupported('UTF8=ACCEPT'); if ($this->UTF8) { - $this->SendRequestGetResponse('ENABLE', array('UTF8=ACCEPT')); + $this->Enable('ENABLE', 'UTF8=ACCEPT'); } } catch (Exceptions\NegativeResponseException $oException) @@ -310,6 +310,19 @@ class ImapClient extends \MailSo\Net\NetClient return $sExtentionName && \in_array(\strtoupper($sExtentionName), $this->Capability() ?: []); } + /** + * RFC 5161 + */ + public function Enable(/*string|array*/ $mCapabilityNames) : void + { + if (\is_string($mCapabilityNames)) { + $mCapabilityNames = [$mCapabilityNames]; + } + if (\is_array($mCapabilityNames)) { + $this->SendRequestGetResponse('ENABLE', $mCapabilityNames); + } + } + /** * @throws \MailSo\Net\Exceptions\Exception * @throws \MailSo\Imap\Exceptions\Exception @@ -637,6 +650,26 @@ class ImapClient extends \MailSo\Net\NetClient return 'UNKNOWN'; } + /** + * RFC 4978 + * It is RECOMMENDED that the client uses TLS compression. + *//* + public function Compress() : bool + { + try { + if ($this->IsSupported('COMPRESS=DEFLATE')) { + $this->SendRequestGetResponse('COMPRESS', ['DEFLATE']); + \stream_filter_append($this->ConnectionResource(), 'zlib.inflate'); + \stream_filter_append($this->ConnectionResource(), 'zlib.deflate', STREAM_FILTER_WRITE, array( + 'level' => 6, 'window' => 15, 'memory' => 9 + )); + return true; + } + } catch (\Throwable $e) { + } + return false; + }*/ + public function EscapeFolderName(string $sFolderName) : string { return $this->EscapeString($this->UTF8 ? $sFolderName : \MailSo\Base\Utils::Utf8ToUtf7Modified($sFolderName)); diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Requests/SORT.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Requests/SORT.php index 751fb7ddc..51cb90d1c 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Requests/SORT.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Requests/SORT.php @@ -30,7 +30,7 @@ class SORT extends Request $bUid = true, $aSortTypes = [], $sLimit = '', - // rfc5267 + // RFC 5267 $aReturn = [ /** ALL diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/Status.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/Status.php index 8e0833c70..425f5e84f 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/Status.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Traits/Status.php @@ -63,7 +63,7 @@ trait Status $UNSEEN, /** - * RFC4551 + * RFC 4551 * The highest mod-sequence value of all messages in the mailbox. * This response also occurs as a result of a SELECT or EXAMINE command. * @var int 1*DIGIT Positive unsigned 64-bit integer @@ -71,14 +71,14 @@ trait Status $HIGHESTMODSEQ, /** - * RFC7889 + * RFC 7889 * Message upload size limit. * @var int */ $APPENDLIMIT, /** - * RFC8474 + * RFC 8474 * A server-allocated unique identifier for the mailbox. * This response also occurs as a result of a CREATE, SELECT or EXAMINE command. * @var string