de.propeace.mailinglistsync/Civi/Mailinglistsync/MailingListManager.php
2025-03-04 11:15:09 +01:00

98 lines
2.1 KiB
PHP

<?php
namespace Civi\Mailinglistsync;
use CRM_Mailinglistsync_ExtensionUtil as E;
class MailingListManager {
/**
* Is the mailing list enabled?
*
* @var bool
*/
private bool $enabled;
/**
* Is logging enabled?
*
* @var bool
*/
private mixed $logging;
/**
* Host of the mlmmj server
*
* @var string
*/
private string $mlmmjHost;
/**
* Token for the mlmmj server
*
* @var string
*/
private string $mlmmjToken;
/**
* Port of the mlmmj server
*
* @var int
*/
private int $mlmmjPort;
/**
* Host of the dovecot server
*
* @var string|mixed
*/
private string $dovecotHost;
/**
* Token for the dovecot server
*
* @var string|mixed
*/
private string $dovecotToken;
/**
* Port of the dovecot server
*
* @var int
*/
private int $dovecotPort;
/**
* Constructor.
*
* @throws \Exception
*/
function __construct() {
// Load settings
$settings = MailingListSettings::get();
$this->enabled = $settings[E::SHORT_NAME . '_enable'] ?? FALSE;
$this->logging = $settings[E::SHORT_NAME . '_logging'] ?? FALSE;
$this->mlmmjHost = $settings[E::SHORT_NAME . '_mlmmj_host'] ??
throw new \Exception('No mlmmj host set');
$this->mlmmjToken = $settings[E::SHORT_NAME . '_mlmmj_token'] ??
throw new \Exception('No mlmmj token set');
$this->mlmmjPort = $settings[E::SHORT_NAME . '_mlmmj_port'] ?? 443;
$this->dovecotHost = $settings[E::SHORT_NAME . '_dovecot_host'] ??
throw new \Exception('No dovecot host set');
$this->dovecotToken = $settings[E::SHORT_NAME . '_dovecot_token'] ??
throw new \Exception('No dovecot token set');
$this->dovecotPort = $settings[E::SHORT_NAME . '_dovecot_port'] ?? 443;
}
function createEmailAddress(string $emailAddress) {} // TODO
function deleteEmailAddress(string $emailAddress) {} // TODO
function createMailingList(BaseMailingList $mailingList) {} // TODO
function deleteMailingList(BaseMailingList $mailingList) {} // TODO
function updateMailingList(BaseMailingList $mailingList) {} // TODO
}