From 94aa2f11c4832b516765b5efcd4d736db6b90b94 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Tue, 19 Mar 2024 19:49:11 +0100 Subject: [PATCH] Rename MessageSimple* commands to Message* --- .../ImapContactsSuggestions.php | 2 +- plugins/imap-contacts-suggestions/index.php | 6 +++--- plugins/kolab/KolabAddressBook.php | 4 ++-- plugins/kolab/index.php | 6 +++--- .../libraries/MailSo/Imap/Commands/Folders.php | 4 ++-- .../libraries/MailSo/Imap/Commands/Messages.php | 10 +++++----- .../app/libraries/MailSo/Imap/Requests/SORT.php | 4 ++++ .../libraries/MailSo/Imap/Requests/THREAD.php | 1 + .../app/libraries/MailSo/Mail/MailClient.php | 16 ++++++++-------- .../0.0.0/app/libraries/MailSo/Mail/Message.php | 1 + 10 files changed, 30 insertions(+), 24 deletions(-) diff --git a/plugins/imap-contacts-suggestions/ImapContactsSuggestions.php b/plugins/imap-contacts-suggestions/ImapContactsSuggestions.php index 6b23e8de6..9a379ff26 100644 --- a/plugins/imap-contacts-suggestions/ImapContactsSuggestions.php +++ b/plugins/imap-contacts-suggestions/ImapContactsSuggestions.php @@ -24,7 +24,7 @@ class ImapContactsSuggestions implements \RainLoop\Providers\Suggestions\ISugges $sQuery = \MailSo\Imap\SearchCriterias::escapeSearchString($oImapClient, $sQuery); $aUids = \array_slice( - $oImapClient->MessageSimpleSearch("FROM {$sQuery}"), + $oImapClient->MessageSearch("FROM {$sQuery}"), 0, $iLimit ); diff --git a/plugins/imap-contacts-suggestions/index.php b/plugins/imap-contacts-suggestions/index.php index 351e2de01..559e77770 100644 --- a/plugins/imap-contacts-suggestions/index.php +++ b/plugins/imap-contacts-suggestions/index.php @@ -4,11 +4,11 @@ class ImapContactsSuggestionsPlugin extends \RainLoop\Plugins\AbstractPlugin { const NAME = 'Contacts suggestions (IMAP folder)', - VERSION = '1.2', - RELEASE = '2023-01-17', + VERSION = '2.36', + RELEASE = '2024-03-19', CATEGORY = 'Contacts', DESCRIPTION = 'Get contacts suggestions from IMAP INBOX folder.', - REQUIRED = '2.24.6'; + REQUIRED = '2.36.0'; public function Init() : void { diff --git a/plugins/kolab/KolabAddressBook.php b/plugins/kolab/KolabAddressBook.php index 8c7df9316..c934af1d7 100644 --- a/plugins/kolab/KolabAddressBook.php +++ b/plugins/kolab/KolabAddressBook.php @@ -340,7 +340,7 @@ class KolabAddressBook implements \RainLoop\Providers\AddressBook\AddressBookInt $sSearch = \MailSo\Imap\SearchCriterias::escapeSearchString($this->ImapClient(), $sSearch); $aUids = \array_slice( - $this->ImapClient()->MessageSimpleSearch("FROM {$sSearch}"), + $this->ImapClient()->MessageSearch("FROM {$sSearch}"), 0, $iLimit ); @@ -361,7 +361,7 @@ class KolabAddressBook implements \RainLoop\Providers\AddressBook\AddressBookInt if ($bCreateAuto) { foreach ($aEmails as $sEmail => $sAddress) { $sSearch = \MailSo\Imap\SearchCriterias::escapeSearchString($this->ImapClient(), $sEmail); - if (!$this->ImapClient()->MessageSimpleSearch("FROM {$sSearch}")) { + if (!$this->ImapClient()->MessageSearch("FROM {$sSearch}")) { $oVCard = new VCard; $oVCard->add('EMAIL', $sEmail); $sFullName = \trim(\MailSo\Mime\Email::Parse(\trim($sAddress))->GetDisplayName()); diff --git a/plugins/kolab/index.php b/plugins/kolab/index.php index 615dd4e7b..952427387 100644 --- a/plugins/kolab/index.php +++ b/plugins/kolab/index.php @@ -4,11 +4,11 @@ class KolabPlugin extends \RainLoop\Plugins\AbstractPlugin { const NAME = 'Kolab', - VERSION = '2.6', - RELEASE = '2023-02-10', + VERSION = '2.36', + RELEASE = '2024-03-19', CATEGORY = 'Contacts', DESCRIPTION = 'Use an Address Book of Kolab.', - REQUIRED = '2.26.0'; + REQUIRED = '2.36.0'; public function Init() : void { 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 7e410ff5f..2d219b3ce 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 @@ -184,7 +184,7 @@ trait Folders */ /* if ($this->hasCapability('ESEARCH') && !isset($oFolderInfo->UNSEEN)) { - $oFolderInfo->UNSEEN = $this->MessageSimpleESearch('UNSEEN', ['COUNT'])['COUNT']; + $oFolderInfo->UNSEEN = $this->MessageESearch('UNSEEN', ['COUNT'])['COUNT']; } return $oFolderInfo; */ @@ -435,7 +435,7 @@ trait Folders $oResult->UNSEEN = null; /* if ($this->hasCapability('ESEARCH')) { - $oResult->UNSEEN = $this->MessageSimpleESearch('UNSEEN', ['COUNT'])['COUNT']; + $oResult->UNSEEN = $this->MessageESearch('UNSEEN', ['COUNT'])['COUNT']; } */ $this->oCurrentFolderInfo = $oResult; 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 69293d6bc..fc6d282e1 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 @@ -383,7 +383,7 @@ trait Messages * @throws \MailSo\Net\Exceptions\* * @throws \MailSo\Imap\Exceptions\* */ - public function MessageSimpleSort(array $aSortTypes, string $sSearchCriterias, bool $bReturnUid = true) : array + public function MessageSort(array $aSortTypes, string $sSearchCriterias, bool $bReturnUid = true) : array { $oSort = new \MailSo\Imap\Requests\SORT($this); $oSort->sCriterias = $sSearchCriterias ?: 'ALL'; @@ -412,7 +412,7 @@ trait Messages * @throws \MailSo\Net\Exceptions\* * @throws \MailSo\Imap\Exceptions\* */ - public function MessageSimpleESearch(string $sSearchCriterias, array $aSearchReturn = null, bool $bReturnUid = true, string $sLimit = '') : array + public function MessageESearch(string $sSearchCriterias, array $aSearchReturn = null, bool $bReturnUid = true, string $sLimit = '') : array { $oESearch = new \MailSo\Imap\Requests\ESEARCH($this); $oESearch->sCriterias = $sSearchCriterias ?: 'ALL'; @@ -433,7 +433,7 @@ trait Messages * @throws \MailSo\Net\Exceptions\* * @throws \MailSo\Imap\Exceptions\* */ - public function MessageSimpleESort(array $aSortTypes, string $sSearchCriterias, array $aSearchReturn = ['ALL'], bool $bReturnUid = true, string $sLimit = '') : array + public function MessageESort(array $aSortTypes, string $sSearchCriterias, array $aSearchReturn = ['ALL'], bool $bReturnUid = true, string $sLimit = '') : array { $oSort = new \MailSo\Imap\Requests\SORT($this); $oSort->sCriterias = $sSearchCriterias ?: 'ALL'; @@ -451,7 +451,7 @@ trait Messages * @throws \MailSo\Net\Exceptions\* * @throws \MailSo\Imap\Exceptions\* */ - public function MessageSimpleSearch(string $sSearchCriterias, bool $bReturnUid = true) : array + public function MessageSearch(string $sSearchCriterias, bool $bReturnUid = true) : array { $aRequest = array(); // if (!$this->UTF8 && !\mb_check_encoding($sSearchCriterias, 'UTF-8')) { @@ -502,7 +502,7 @@ trait Messages * @throws \MailSo\Net\Exceptions\* * @throws \MailSo\Imap\Exceptions\* */ - public function MessageSimpleThread(string $sSearchCriterias, bool $bReturnUid = true) : iterable + public function MessageThread(string $sSearchCriterias, bool $bReturnUid = true) : iterable { $oThread = new \MailSo\Imap\Requests\THREAD($this); $oThread->sCriterias = $sSearchCriterias ?: 'ALL'; 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 7e4e28e64..3c34ed67f 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 @@ -21,6 +21,7 @@ namespace MailSo\Imap\Requests; */ class SORT extends Request { + // a parenthesized list of sort criteria public string $sCriterias = 'ALL'; public string $sCharset = ''; @@ -52,6 +53,9 @@ class SORT extends Request PARTIAL 1:500 Return all message numbers/UIDs which match the search criteria, in the requested sort order, using a sequence-set. + + SAVE + This option tells the server to remember the result. */ ]; diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Requests/THREAD.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Requests/THREAD.php index 9175c087b..33665ed2e 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Requests/THREAD.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/Requests/THREAD.php @@ -23,6 +23,7 @@ class THREAD extends Request // ORDEREDSUBJECT or REFERENCES or REFS private string $sAlgorithm = ''; + // a parenthesized list of sort criteria public string $sCriterias = 'ALL'; public bool $bUid = true; diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php index ec0795514..e2630dc65 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php @@ -410,8 +410,8 @@ class MailClient $sSerializedHashKey = null; if ($oCacher && $oCacher->IsInited()) { $sSerializedHashKey = - "ThreadsMapSorted/{$sSearch}/{$sFolderName}/{$oMessageCollection->FolderInfo->etag}"; -// "ThreadsMapSorted/{$sSearch}/{$iThreadLimit}/{$sFolderName}/{$oMessageCollection->FolderInfo->etag}"; + "ThreadsMapSorted/{$sSearch}/{$oMessageCollection->FolderInfo->etag}"; +// "ThreadsMapSorted/{$sSearch}/{$iThreadLimit}/{$oMessageCollection->FolderInfo->etag}"; $this->logWrite($sSerializedHashKey); @@ -441,7 +441,7 @@ class MailClient $aResult = array(); try { - foreach ($this->oImapClient->MessageSimpleThread($sSearch) as $mItem) { + foreach ($this->oImapClient->MessageThread($sSearch) as $mItem) { // Flatten to single level $aMap = []; \array_walk_recursive($mItem, function($a) use (&$aMap) { $aMap[] = $a; }); @@ -628,12 +628,12 @@ class MailClient $aResultUids = []; if ($bUseSort) { // $this->oImapClient->hasCapability('ESORT') -// $aResultUids = $this->oImapClient->MessageSimpleESort($aSortTypes, $oSearchCriterias)['ALL']; - $aResultUids = $this->oImapClient->MessageSimpleSort($aSortTypes, $oSearchCriterias, $bReturnUid); +// $aResultUids = $this->oImapClient->MessageESort($aSortTypes, $oSearchCriterias)['ALL']; + $aResultUids = $this->oImapClient->MessageSort($aSortTypes, $oSearchCriterias, $bReturnUid); } else { // $this->oImapClient->hasCapability('ESEARCH') -// $aResultUids = $this->oImapClient->MessageSimpleESearch($oSearchCriterias, null, $bReturnUid) - $aResultUids = $this->oImapClient->MessageSimpleSearch($oSearchCriterias, $bReturnUid); +// $aResultUids = $this->oImapClient->MessageESearch($oSearchCriterias, null, $bReturnUid) + $aResultUids = $this->oImapClient->MessageSearch($oSearchCriterias, $bReturnUid); } if ($bUseCache) { @@ -848,7 +848,7 @@ class MailClient $this->oImapClient->FolderExamine($sFolderName); - $aUids = $this->oImapClient->MessageSimpleSearch('HEADER Message-ID '.$sMessageId); + $aUids = $this->oImapClient->MessageSearch('HEADER Message-ID '.$sMessageId); return 1 === \count($aUids) && \is_numeric($aUids[0]) ? (int) $aUids[0] : null; } diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php index 9c234fd0d..f84537edc 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/Message.php @@ -548,6 +548,7 @@ class Message implements \JsonSerializable } if ($this->References) { $result['references'] = $this->References; +// $result['references'] = \explode(' ', $this->References); } if ($this->sHtml || $this->sPlain) { $result['html'] = $this->sHtml;