Rename MessageSimple* commands to Message*

This commit is contained in:
the-djmaze 2024-03-19 19:49:11 +01:00
parent 173a172cf8
commit 94aa2f11c4
10 changed files with 30 additions and 24 deletions

View file

@ -24,7 +24,7 @@ class ImapContactsSuggestions implements \RainLoop\Providers\Suggestions\ISugges
$sQuery = \MailSo\Imap\SearchCriterias::escapeSearchString($oImapClient, $sQuery); $sQuery = \MailSo\Imap\SearchCriterias::escapeSearchString($oImapClient, $sQuery);
$aUids = \array_slice( $aUids = \array_slice(
$oImapClient->MessageSimpleSearch("FROM {$sQuery}"), $oImapClient->MessageSearch("FROM {$sQuery}"),
0, $iLimit 0, $iLimit
); );

View file

@ -4,11 +4,11 @@ class ImapContactsSuggestionsPlugin extends \RainLoop\Plugins\AbstractPlugin
{ {
const const
NAME = 'Contacts suggestions (IMAP folder)', NAME = 'Contacts suggestions (IMAP folder)',
VERSION = '1.2', VERSION = '2.36',
RELEASE = '2023-01-17', RELEASE = '2024-03-19',
CATEGORY = 'Contacts', CATEGORY = 'Contacts',
DESCRIPTION = 'Get contacts suggestions from IMAP INBOX folder.', DESCRIPTION = 'Get contacts suggestions from IMAP INBOX folder.',
REQUIRED = '2.24.6'; REQUIRED = '2.36.0';
public function Init() : void public function Init() : void
{ {

View file

@ -340,7 +340,7 @@ class KolabAddressBook implements \RainLoop\Providers\AddressBook\AddressBookInt
$sSearch = \MailSo\Imap\SearchCriterias::escapeSearchString($this->ImapClient(), $sSearch); $sSearch = \MailSo\Imap\SearchCriterias::escapeSearchString($this->ImapClient(), $sSearch);
$aUids = \array_slice( $aUids = \array_slice(
$this->ImapClient()->MessageSimpleSearch("FROM {$sSearch}"), $this->ImapClient()->MessageSearch("FROM {$sSearch}"),
0, $iLimit 0, $iLimit
); );
@ -361,7 +361,7 @@ class KolabAddressBook implements \RainLoop\Providers\AddressBook\AddressBookInt
if ($bCreateAuto) { if ($bCreateAuto) {
foreach ($aEmails as $sEmail => $sAddress) { foreach ($aEmails as $sEmail => $sAddress) {
$sSearch = \MailSo\Imap\SearchCriterias::escapeSearchString($this->ImapClient(), $sEmail); $sSearch = \MailSo\Imap\SearchCriterias::escapeSearchString($this->ImapClient(), $sEmail);
if (!$this->ImapClient()->MessageSimpleSearch("FROM {$sSearch}")) { if (!$this->ImapClient()->MessageSearch("FROM {$sSearch}")) {
$oVCard = new VCard; $oVCard = new VCard;
$oVCard->add('EMAIL', $sEmail); $oVCard->add('EMAIL', $sEmail);
$sFullName = \trim(\MailSo\Mime\Email::Parse(\trim($sAddress))->GetDisplayName()); $sFullName = \trim(\MailSo\Mime\Email::Parse(\trim($sAddress))->GetDisplayName());

View file

@ -4,11 +4,11 @@ class KolabPlugin extends \RainLoop\Plugins\AbstractPlugin
{ {
const const
NAME = 'Kolab', NAME = 'Kolab',
VERSION = '2.6', VERSION = '2.36',
RELEASE = '2023-02-10', RELEASE = '2024-03-19',
CATEGORY = 'Contacts', CATEGORY = 'Contacts',
DESCRIPTION = 'Use an Address Book of Kolab.', DESCRIPTION = 'Use an Address Book of Kolab.',
REQUIRED = '2.26.0'; REQUIRED = '2.36.0';
public function Init() : void public function Init() : void
{ {

View file

@ -184,7 +184,7 @@ trait Folders
*/ */
/* /*
if ($this->hasCapability('ESEARCH') && !isset($oFolderInfo->UNSEEN)) { if ($this->hasCapability('ESEARCH') && !isset($oFolderInfo->UNSEEN)) {
$oFolderInfo->UNSEEN = $this->MessageSimpleESearch('UNSEEN', ['COUNT'])['COUNT']; $oFolderInfo->UNSEEN = $this->MessageESearch('UNSEEN', ['COUNT'])['COUNT'];
} }
return $oFolderInfo; return $oFolderInfo;
*/ */
@ -435,7 +435,7 @@ trait Folders
$oResult->UNSEEN = null; $oResult->UNSEEN = null;
/* /*
if ($this->hasCapability('ESEARCH')) { if ($this->hasCapability('ESEARCH')) {
$oResult->UNSEEN = $this->MessageSimpleESearch('UNSEEN', ['COUNT'])['COUNT']; $oResult->UNSEEN = $this->MessageESearch('UNSEEN', ['COUNT'])['COUNT'];
} }
*/ */
$this->oCurrentFolderInfo = $oResult; $this->oCurrentFolderInfo = $oResult;

View file

@ -383,7 +383,7 @@ trait Messages
* @throws \MailSo\Net\Exceptions\* * @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\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 = new \MailSo\Imap\Requests\SORT($this);
$oSort->sCriterias = $sSearchCriterias ?: 'ALL'; $oSort->sCriterias = $sSearchCriterias ?: 'ALL';
@ -412,7 +412,7 @@ trait Messages
* @throws \MailSo\Net\Exceptions\* * @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\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 = new \MailSo\Imap\Requests\ESEARCH($this);
$oESearch->sCriterias = $sSearchCriterias ?: 'ALL'; $oESearch->sCriterias = $sSearchCriterias ?: 'ALL';
@ -433,7 +433,7 @@ trait Messages
* @throws \MailSo\Net\Exceptions\* * @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\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 = new \MailSo\Imap\Requests\SORT($this);
$oSort->sCriterias = $sSearchCriterias ?: 'ALL'; $oSort->sCriterias = $sSearchCriterias ?: 'ALL';
@ -451,7 +451,7 @@ trait Messages
* @throws \MailSo\Net\Exceptions\* * @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\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(); $aRequest = array();
// if (!$this->UTF8 && !\mb_check_encoding($sSearchCriterias, 'UTF-8')) { // if (!$this->UTF8 && !\mb_check_encoding($sSearchCriterias, 'UTF-8')) {
@ -502,7 +502,7 @@ trait Messages
* @throws \MailSo\Net\Exceptions\* * @throws \MailSo\Net\Exceptions\*
* @throws \MailSo\Imap\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 = new \MailSo\Imap\Requests\THREAD($this);
$oThread->sCriterias = $sSearchCriterias ?: 'ALL'; $oThread->sCriterias = $sSearchCriterias ?: 'ALL';

View file

@ -21,6 +21,7 @@ namespace MailSo\Imap\Requests;
*/ */
class SORT extends Request class SORT extends Request
{ {
// a parenthesized list of sort criteria
public string $sCriterias = 'ALL'; public string $sCriterias = 'ALL';
public string $sCharset = ''; public string $sCharset = '';
@ -52,6 +53,9 @@ class SORT extends Request
PARTIAL 1:500 PARTIAL 1:500
Return all message numbers/UIDs which match the search criteria, Return all message numbers/UIDs which match the search criteria,
in the requested sort order, using a sequence-set. in the requested sort order, using a sequence-set.
SAVE
This option tells the server to remember the result.
*/ */
]; ];

View file

@ -23,6 +23,7 @@ class THREAD extends Request
// ORDEREDSUBJECT or REFERENCES or REFS // ORDEREDSUBJECT or REFERENCES or REFS
private string $sAlgorithm = ''; private string $sAlgorithm = '';
// a parenthesized list of sort criteria
public string $sCriterias = 'ALL'; public string $sCriterias = 'ALL';
public bool $bUid = true; public bool $bUid = true;

View file

@ -410,8 +410,8 @@ class MailClient
$sSerializedHashKey = null; $sSerializedHashKey = null;
if ($oCacher && $oCacher->IsInited()) { if ($oCacher && $oCacher->IsInited()) {
$sSerializedHashKey = $sSerializedHashKey =
"ThreadsMapSorted/{$sSearch}/{$sFolderName}/{$oMessageCollection->FolderInfo->etag}"; "ThreadsMapSorted/{$sSearch}/{$oMessageCollection->FolderInfo->etag}";
// "ThreadsMapSorted/{$sSearch}/{$iThreadLimit}/{$sFolderName}/{$oMessageCollection->FolderInfo->etag}"; // "ThreadsMapSorted/{$sSearch}/{$iThreadLimit}/{$oMessageCollection->FolderInfo->etag}";
$this->logWrite($sSerializedHashKey); $this->logWrite($sSerializedHashKey);
@ -441,7 +441,7 @@ class MailClient
$aResult = array(); $aResult = array();
try try
{ {
foreach ($this->oImapClient->MessageSimpleThread($sSearch) as $mItem) { foreach ($this->oImapClient->MessageThread($sSearch) as $mItem) {
// Flatten to single level // Flatten to single level
$aMap = []; $aMap = [];
\array_walk_recursive($mItem, function($a) use (&$aMap) { $aMap[] = $a; }); \array_walk_recursive($mItem, function($a) use (&$aMap) { $aMap[] = $a; });
@ -628,12 +628,12 @@ class MailClient
$aResultUids = []; $aResultUids = [];
if ($bUseSort) { if ($bUseSort) {
// $this->oImapClient->hasCapability('ESORT') // $this->oImapClient->hasCapability('ESORT')
// $aResultUids = $this->oImapClient->MessageSimpleESort($aSortTypes, $oSearchCriterias)['ALL']; // $aResultUids = $this->oImapClient->MessageESort($aSortTypes, $oSearchCriterias)['ALL'];
$aResultUids = $this->oImapClient->MessageSimpleSort($aSortTypes, $oSearchCriterias, $bReturnUid); $aResultUids = $this->oImapClient->MessageSort($aSortTypes, $oSearchCriterias, $bReturnUid);
} else { } else {
// $this->oImapClient->hasCapability('ESEARCH') // $this->oImapClient->hasCapability('ESEARCH')
// $aResultUids = $this->oImapClient->MessageSimpleESearch($oSearchCriterias, null, $bReturnUid) // $aResultUids = $this->oImapClient->MessageESearch($oSearchCriterias, null, $bReturnUid)
$aResultUids = $this->oImapClient->MessageSimpleSearch($oSearchCriterias, $bReturnUid); $aResultUids = $this->oImapClient->MessageSearch($oSearchCriterias, $bReturnUid);
} }
if ($bUseCache) { if ($bUseCache) {
@ -848,7 +848,7 @@ class MailClient
$this->oImapClient->FolderExamine($sFolderName); $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; return 1 === \count($aUids) && \is_numeric($aUids[0]) ? (int) $aUids[0] : null;
} }

View file

@ -548,6 +548,7 @@ class Message implements \JsonSerializable
} }
if ($this->References) { if ($this->References) {
$result['references'] = $this->References; $result['references'] = $this->References;
// $result['references'] = \explode(' ', $this->References);
} }
if ($this->sHtml || $this->sPlain) { if ($this->sHtml || $this->sPlain) {
$result['html'] = $this->sHtml; $result['html'] = $this->sHtml;