mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-26 09:03:48 +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
|
||||
|
||||
class KolabContactsSuggestions implements \RainLoop\Providers\Suggestions\ISuggestions
|
||||
class ImapContactsSuggestions implements \RainLoop\Providers\Suggestions\ISuggestions
|
||||
{
|
||||
// TODO: make setting
|
||||
public $sFolderName = 'Contacts';
|
||||
public $sFolderName = 'INBOX';
|
||||
|
||||
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();
|
||||
|
||||
$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);
|
||||
|
||||
$sQuery = \MailSo\Imap\SearchCriterias::escapeSearchString($oImapClient, $sQuery);
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
|
||||
class KolabPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||
class ImapContactsSuggestionsPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||
{
|
||||
const
|
||||
NAME = 'Kolab',
|
||||
NAME = 'Contacts suggestions (IMAP folder)',
|
||||
VERSION = '0.1',
|
||||
RELEASE = '2022-05-13',
|
||||
RELEASE = '2022-05-17',
|
||||
CATEGORY = 'Security',
|
||||
DESCRIPTION = 'Get contacts suggestions from Kolab.',
|
||||
DESCRIPTION = 'Get contacts suggestions from IMAP folder.',
|
||||
REQUIRED = '2.15.2';
|
||||
|
||||
public function Init() : void
|
||||
|
@ -29,10 +29,10 @@ class KolabPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
if (!\is_array($mResult)) {
|
||||
$mResult = array();
|
||||
}
|
||||
// $sFolder = \trim($this->Config()->Get('plugin', 'mailbox', ''));
|
||||
// $sFolder = \trim($this->Config()->Get('plugin', 'mailbox', 'INBOX'));
|
||||
// if ($sFolder) {
|
||||
include_once __DIR__ . '/KolabContactsSuggestions.php';
|
||||
$mResult[] = new KolabContactsSuggestions();
|
||||
include_once __DIR__ . '/ImapContactsSuggestions.php';
|
||||
$mResult[] = new ImapContactsSuggestions();
|
||||
// }
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue