mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-27 01:28:56 +08:00
Move the Kolab Contacts Suggestions test to be IMAP Contacts Suggestions
This commit is contained in:
parent
ddb95b925d
commit
86ac71ea2e
3 changed files with 9 additions and 15 deletions
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class KolabContactsSuggestions implements \RainLoop\Providers\Suggestions\ISuggestions
|
class ImapContactsSuggestions implements \RainLoop\Providers\Suggestions\ISuggestions
|
||||||
{
|
{
|
||||||
// TODO: make setting
|
// TODO: make setting
|
||||||
public $sFolderName = 'Contacts';
|
public $sFolderName = 'INBOX';
|
||||||
|
|
||||||
public function Process(\RainLoop\Model\Account $oAccount, string $sQuery, int $iLimit = 20): array
|
public function Process(\RainLoop\Model\Account $oAccount, string $sQuery, int $iLimit = 20): array
|
||||||
{
|
{
|
||||||
|
@ -20,12 +20,6 @@ class KolabContactsSuggestions implements \RainLoop\Providers\Suggestions\ISugge
|
||||||
}
|
}
|
||||||
$oImapClient = $oMailClient->ImapClient();
|
$oImapClient = $oMailClient->ImapClient();
|
||||||
|
|
||||||
$metadata = $oImapClient->FolderGetMetadata($this->sFolderName, [\MailSo\Imap\Enumerations\MetadataKeys::KOLAB_CTYPE]);
|
|
||||||
if ($metadata && 'contact' !== \array_shift($metadata)) {
|
|
||||||
// Throw error
|
|
||||||
// $oImapClient->FolderList() : array
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
$oImapClient->FolderSelect($this->sFolderName);
|
$oImapClient->FolderSelect($this->sFolderName);
|
||||||
|
|
||||||
$sQuery = \MailSo\Imap\SearchCriterias::escapeSearchString($oImapClient, $sQuery);
|
$sQuery = \MailSo\Imap\SearchCriterias::escapeSearchString($oImapClient, $sQuery);
|
|
@ -1,13 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class KolabPlugin extends \RainLoop\Plugins\AbstractPlugin
|
class ImapContactsSuggestionsPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
{
|
{
|
||||||
const
|
const
|
||||||
NAME = 'Kolab',
|
NAME = 'Contacts suggestions (IMAP folder)',
|
||||||
VERSION = '0.1',
|
VERSION = '0.1',
|
||||||
RELEASE = '2022-05-13',
|
RELEASE = '2022-05-17',
|
||||||
CATEGORY = 'Security',
|
CATEGORY = 'Security',
|
||||||
DESCRIPTION = 'Get contacts suggestions from Kolab.',
|
DESCRIPTION = 'Get contacts suggestions from IMAP folder.',
|
||||||
REQUIRED = '2.15.2';
|
REQUIRED = '2.15.2';
|
||||||
|
|
||||||
public function Init() : void
|
public function Init() : void
|
||||||
|
@ -29,10 +29,10 @@ class KolabPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
if (!\is_array($mResult)) {
|
if (!\is_array($mResult)) {
|
||||||
$mResult = array();
|
$mResult = array();
|
||||||
}
|
}
|
||||||
// $sFolder = \trim($this->Config()->Get('plugin', 'mailbox', ''));
|
// $sFolder = \trim($this->Config()->Get('plugin', 'mailbox', 'INBOX'));
|
||||||
// if ($sFolder) {
|
// if ($sFolder) {
|
||||||
include_once __DIR__ . '/KolabContactsSuggestions.php';
|
include_once __DIR__ . '/ImapContactsSuggestions.php';
|
||||||
$mResult[] = new KolabContactsSuggestions();
|
$mResult[] = new ImapContactsSuggestions();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue