mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
AddressBookProvider belongs to Contacts actions
This commit is contained in:
parent
27f5ba9337
commit
6e24f45d4a
2 changed files with 29 additions and 30 deletions
|
|
@ -101,11 +101,6 @@ class Actions
|
|||
*/
|
||||
protected $oLocalSettingsProvider = null;
|
||||
|
||||
/**
|
||||
* @var \RainLoop\Providers\AddressBook
|
||||
*/
|
||||
protected $oAddressBookProvider = null;
|
||||
|
||||
/**
|
||||
* @var \RainLoop\Config\Application
|
||||
*/
|
||||
|
|
@ -468,31 +463,6 @@ class Actions
|
|||
return $this->oDomainProvider;
|
||||
}
|
||||
|
||||
public function AddressBookProvider(?Model\Account $oAccount = null): Providers\AddressBook
|
||||
{
|
||||
if (null === $this->oAddressBookProvider) {
|
||||
$oDriver = null;
|
||||
try {
|
||||
// if ($this->oConfig->Get('contacts', 'enable', false)) {
|
||||
if ($this->GetCapa(Capa::CONTACTS)) {
|
||||
$oDriver = $this->fabrica('address-book', $oAccount);
|
||||
}
|
||||
if ($oAccount && $oDriver) {
|
||||
$oDriver->SetEmail($this->GetMainEmail($oAccount));
|
||||
$oDriver->setDAVClientConfig($this->getContactsSyncData($oAccount));
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
\SnappyMail\LOG::error('AddressBook', $e->getMessage()."\n".$e->getTraceAsString());
|
||||
$oDriver = null;
|
||||
// $oDriver = new Providers\AddressBook\PdoAddressBook();
|
||||
}
|
||||
$this->oAddressBookProvider = new Providers\AddressBook($oDriver);
|
||||
$this->oAddressBookProvider->SetLogger($this->oLogger);
|
||||
}
|
||||
|
||||
return $this->oAddressBookProvider;
|
||||
}
|
||||
|
||||
public function Cacher(?Model\Account $oAccount = null, bool $bForceFile = false): \MailSo\Cache\CacheClient
|
||||
{
|
||||
$sKey = '';
|
||||
|
|
|
|||
|
|
@ -4,6 +4,35 @@ namespace RainLoop\Actions;
|
|||
|
||||
trait Contacts
|
||||
{
|
||||
/**
|
||||
* @var \RainLoop\Providers\AddressBook
|
||||
*/
|
||||
protected $oAddressBookProvider = null;
|
||||
|
||||
public function AddressBookProvider(?Model\Account $oAccount = null): Providers\AddressBook
|
||||
{
|
||||
if (null === $this->oAddressBookProvider) {
|
||||
$oDriver = null;
|
||||
try {
|
||||
// if ($this->oConfig->Get('contacts', 'enable', false)) {
|
||||
if ($this->GetCapa(Capa::CONTACTS)) {
|
||||
$oDriver = $this->fabrica('address-book', $oAccount);
|
||||
}
|
||||
if ($oAccount && $oDriver) {
|
||||
$oDriver->SetEmail($this->GetMainEmail($oAccount));
|
||||
$oDriver->setDAVClientConfig($this->getContactsSyncData($oAccount));
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
\SnappyMail\LOG::error('AddressBook', $e->getMessage()."\n".$e->getTraceAsString());
|
||||
$oDriver = null;
|
||||
// $oDriver = new Providers\AddressBook\PdoAddressBook();
|
||||
}
|
||||
$this->oAddressBookProvider = new Providers\AddressBook($oDriver);
|
||||
$this->oAddressBookProvider->SetLogger($this->oLogger);
|
||||
}
|
||||
|
||||
return $this->oAddressBookProvider;
|
||||
}
|
||||
|
||||
public function DoSaveContactsSyncData() : array
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue