mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Make #879 optional
This commit is contained in:
parent
dc6674af4a
commit
82a1f4d781
2 changed files with 19 additions and 4 deletions
|
|
@ -7,6 +7,13 @@ class NextcloudContactsSuggestions implements \RainLoop\Providers\Suggestions\IS
|
||||||
*/
|
*/
|
||||||
private $oLogger = null;
|
private $oLogger = null;
|
||||||
|
|
||||||
|
private bool $ignoreSystemAddressbook;
|
||||||
|
|
||||||
|
function __construct(bool $ignoreSystemAddressbook = true)
|
||||||
|
{
|
||||||
|
$this->ignoreSystemAddressbook = $ignoreSystemAddressbook;
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -22,11 +29,14 @@ class NextcloudContactsSuggestions implements \RainLoop\Providers\Suggestions\IS
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unregister system addressbook so as to return only contacts in user's addressbooks
|
// Unregister system addressbook so as to return only contacts in user's addressbooks
|
||||||
foreach($cm->getUserAddressBooks() as $addressBook) {
|
if ($this->ignoreSystemAddressbook) {
|
||||||
if($addressBook->isSystemAddressBook()) {
|
foreach($cm->getUserAddressBooks() as $addressBook) {
|
||||||
$cm->unregisterAddressBook($addressBook);
|
if($addressBook->isSystemAddressBook()) {
|
||||||
|
$cm->unregisterAddressBook($addressBook);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$aSearchResult = $cm->search($sQuery, array('FN', 'NICKNAME', 'TITLE', 'EMAIL'));
|
$aSearchResult = $cm->search($sQuery, array('FN', 'NICKNAME', 'TITLE', 'EMAIL'));
|
||||||
|
|
||||||
//$this->oLogger->WriteDump($aSearchResult);
|
//$this->oLogger->WriteDump($aSearchResult);
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,9 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
$mResult = array();
|
$mResult = array();
|
||||||
}
|
}
|
||||||
include_once __DIR__ . '/NextcloudContactsSuggestions.php';
|
include_once __DIR__ . '/NextcloudContactsSuggestions.php';
|
||||||
$mResult[] = new NextcloudContactsSuggestions();
|
$mResult[] = new NextcloudContactsSuggestions(
|
||||||
|
$this->Config()->Get('plugin', 'ignoreSystemAddressbook', true)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -213,6 +215,9 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
\RainLoop\Plugins\Property::NewInstance('suggestions')->SetLabel('Suggestions')
|
\RainLoop\Plugins\Property::NewInstance('suggestions')->SetLabel('Suggestions')
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
|
||||||
->SetDefaultValue(true),
|
->SetDefaultValue(true),
|
||||||
|
\RainLoop\Plugins\Property::NewInstance('ignoreSystemAddressbook')->SetLabel('Ignore system addressbook')
|
||||||
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
|
||||||
|
->SetDefaultValue(true),
|
||||||
\RainLoop\Plugins\Property::NewInstance('calendar')->SetLabel('Enable "Put ICS in calendar"')
|
\RainLoop\Plugins\Property::NewInstance('calendar')->SetLabel('Enable "Put ICS in calendar"')
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
|
||||||
->SetDefaultValue(false)
|
->SetDefaultValue(false)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue