Deprecate most Domain methods

This commit is contained in:
the-djmaze 2024-03-10 23:58:18 +01:00
parent ea4cda6a91
commit 1e55f86f51
12 changed files with 80 additions and 69 deletions

View file

@ -269,13 +269,14 @@ class Actions
}
if ($oAccount) {
$oDomain = $oAccount->Domain();
$sLine = \str_replace('{imap:login}', $oAccount->IncLogin(), $sLine);
$sLine = \str_replace('{imap:host}', $oAccount->Domain()->IncHost(), $sLine);
$sLine = \str_replace('{imap:port}', $oAccount->Domain()->IncPort(), $sLine);
$sLine = \str_replace('{imap:host}', $oDomain->ImapSettings()->host, $sLine);
$sLine = \str_replace('{imap:port}', $oDomain->ImapSettings()->port, $sLine);
$sLine = \str_replace('{smtp:login}', $oAccount->OutLogin(), $sLine);
$sLine = \str_replace('{smtp:host}', $oAccount->Domain()->OutHost(), $sLine);
$sLine = \str_replace('{smtp:port}', $oAccount->Domain()->OutPort(), $sLine);
$sLine = \str_replace('{smtp:host}', $oDomain->SmtpSettings()->host, $sLine);
$sLine = \str_replace('{smtp:port}', $oDomain->SmtpSettings()->port, $sLine);
}
$aClear['/\{imap:([^}]*)\}/i'] = 'imap';
@ -899,7 +900,7 @@ class Actions
'Kolab' => false, // See Kolab plugin
);
}
$aResult[Capa::SIEVE] = $bAdmin || ($oAccount && $oAccount->Domain()->UseSieve());
$aResult[Capa::SIEVE] = $bAdmin || ($oAccount && $oAccount->Domain()->SieveSettings()->enabled);
return $aResult;
}

View file

@ -137,7 +137,7 @@ trait AdminDomains
$sImapErrorDesc = $oException->getMessage();
}
if ($oDomain->OutUsePhpMail()) {
if ($oDomain->SmtpSettings()->usePhpMail) {
$mSmtpResult = \MailSo\Base\Utils::FunctionCallable('mail');
if (!$mSmtpResult) {
$sSmtpErrorDesc = 'PHP: mail() function is undefined';
@ -179,7 +179,7 @@ trait AdminDomains
}
}
if ($oDomain->UseSieve()) {
if ($oDomain->SieveSettings()->enabled) {
try
{
$oSieveClient = new \MailSo\Sieve\SieveClient();

View file

@ -964,7 +964,7 @@ trait Messages
{
$oMessage->SetFrom(new \MailSo\Mime\Email(
$oIdentity->Email(), $oIdentity->Name()));
if ($oAccount->Domain()->OutSetSender()) {
if ($oAccount->Domain()->SmtpSettings()->setSender) {
$oMessage->SetSender(\MailSo\Mime\Email::Parse($oAccount->Email()));
}
}

View file

@ -39,7 +39,7 @@ abstract class Account implements \JsonSerializable
public function IncLogin() : string
{
return $this->oDomain->IncShortLogin()
return $this->oDomain->ImapSettings()->shortLogin
? \MailSo\Base\Utils::GetAccountNameFromEmail($this->sLogin)
: $this->sLogin;
}
@ -52,7 +52,9 @@ abstract class Account implements \JsonSerializable
public function OutLogin() : string
{
$sSmtpLogin = $this->sSmtpLogin ?: $this->sLogin;
return $this->oDomain->OutShortLogin() ? \MailSo\Base\Utils::GetAccountNameFromEmail($sSmtpLogin) : $sSmtpLogin;
return $this->oDomain->SmtpSettings()->shortLogin
? \MailSo\Base\Utils::GetAccountNameFromEmail($sSmtpLogin)
: $sSmtpLogin;
}
public function Domain() : Domain

View file

@ -61,51 +61,60 @@ class Domain implements \JsonSerializable
return $this->Name;
}
/**
* @deprecated
*/
public function IncHost() : string
{
\trigger_error('Deprecated function called.', \E_USER_DEPRECATED);
return $this->IMAP->host;
}
/**
* @deprecated
*/
public function IncPort() : int
{
\trigger_error('Deprecated function called.', \E_USER_DEPRECATED);
return $this->IMAP->port;
}
/**
* @deprecated
*/
public function IncShortLogin() : bool
{
\trigger_error('Deprecated function called.', \E_USER_DEPRECATED);
return $this->IMAP->shortLogin;
}
/**
* @deprecated
*/
public function UseSieve() : bool
{
\trigger_error('Deprecated function called.', \E_USER_DEPRECATED);
return $this->Sieve->enabled;
}
/**
* @deprecated
*/
public function OutHost() : string
{
\trigger_error('Deprecated function called.', \E_USER_DEPRECATED);
return $this->SMTP->host;
}
/**
* @deprecated
*/
public function OutPort() : int
{
\trigger_error('Deprecated function called.', \E_USER_DEPRECATED);
return $this->SMTP->port;
}
public function OutShortLogin() : bool
{
return $this->SMTP->shortLogin;
}
public function OutSetSender() : bool
{
return $this->SMTP->setSender;
}
public function OutUsePhpMail() : bool
{
return $this->SMTP->usePhpMail;
}
public function SetAliasName(string $sAliasName) : void
{
$this->aliasName = $sAliasName;