mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-03-04 10:43:10 +08:00
Change and document plugins hook system
This commit is contained in:
parent
3c8d01a882
commit
e112d1fd70
14 changed files with 395 additions and 79 deletions
345
plugins/README.md
Normal file
345
plugins/README.md
Normal file
|
@ -0,0 +1,345 @@
|
|||
|
||||
class Plugin extends \RainLoop\Plugins\AbstractPlugin
|
||||
|
||||
# Hooks
|
||||
|
||||
$Plugin->addHook('hook.name', 'functionName');
|
||||
|
||||
## Login
|
||||
|
||||
### login.credentials.step-1
|
||||
params:
|
||||
string &$sEmail
|
||||
|
||||
### login.credentials.step-2
|
||||
params:
|
||||
string &$sEmail
|
||||
string &$sPassword
|
||||
|
||||
### login.credentials
|
||||
params:
|
||||
string &$sEmail
|
||||
string &$sLogin
|
||||
string &$sPassword
|
||||
|
||||
### login.success
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
|
||||
## IMAP
|
||||
|
||||
### imap.credentials
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
array &$aCredentials
|
||||
|
||||
### imap.before-connect
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Mail\MailClient $oMailClient
|
||||
array $aCredentials
|
||||
|
||||
### imap.after-connect
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Mail\MailClient $oMailClient
|
||||
array $aCredentials
|
||||
|
||||
### imap.before-login
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Mail\MailClient $oMailClient
|
||||
array $aCredentials
|
||||
|
||||
### imap.after-login
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Mail\MailClient $oMailClient
|
||||
bool $bSuccess
|
||||
array $aCredentials
|
||||
|
||||
## Sieve
|
||||
|
||||
### sieve.credentials
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
array &$aCredentials
|
||||
|
||||
### sieve.before-connect
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Sieve\ManageSieveClient $oSieveClient
|
||||
array $aCredentials
|
||||
|
||||
### sieve.after-connect
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Sieve\ManageSieveClient $oSieveClient
|
||||
array $aCredentials
|
||||
|
||||
### sieve.before-login
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Sieve\ManageSieveClient $oSieveClient
|
||||
bool $bSuccess
|
||||
array $aCredentials
|
||||
|
||||
### sieve.after-login
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Sieve\ManageSieveClient $oSieveClient
|
||||
array $aCredentials
|
||||
|
||||
## SMTP
|
||||
|
||||
### smtp.credentials
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
array &$aCredentials
|
||||
|
||||
### smtp.before-connect
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Smtp\SmtpClient $oSmtpClient
|
||||
array $aCredentials
|
||||
|
||||
### smtp.after-connect
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Smtp\SmtpClient $oSmtpClient
|
||||
array $aCredentials
|
||||
|
||||
### smtp.before-login
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Smtp\SmtpClient $oSmtpClient
|
||||
array $aCredentials
|
||||
|
||||
### smtp.after-login
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Smtp\SmtpClient $oSmtpClient
|
||||
bool $bSuccess
|
||||
array $aCredentials
|
||||
|
||||
## Folders
|
||||
|
||||
### filter.folders-post
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Mail\FolderCollection $oFolderCollection
|
||||
|
||||
### filter.folders-complete
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Mail\FolderCollection $oFolderCollection
|
||||
|
||||
### filter.folders-system-types
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
array &$aList
|
||||
|
||||
### filter.system-folders-names
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
array &$aCache
|
||||
|
||||
## Others
|
||||
|
||||
### filter.account
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
|
||||
### filter.action-params
|
||||
params:
|
||||
string $sMethodName
|
||||
array &$aCurrentActionParams
|
||||
|
||||
### filter.app-data
|
||||
params:
|
||||
bool $bAdmin
|
||||
array &$aAppData
|
||||
|
||||
### filter.application-config
|
||||
params:
|
||||
\RainLoop\Config\Application $oConfig
|
||||
|
||||
### filter.build-message
|
||||
params:
|
||||
\MailSo\Mime\Message $oMessage
|
||||
|
||||
### filter.build-read-receipt-message
|
||||
params:
|
||||
\MailSo\Mime\Message $oMessage
|
||||
\RainLoop\Model\Account $oAccount
|
||||
|
||||
### filter.domain
|
||||
params:
|
||||
\RainLoop\Model\Domain &$oDomain
|
||||
|
||||
### filter.fabrica
|
||||
params:
|
||||
string $sName
|
||||
mixed &$mResult
|
||||
\RainLoop\Model\Account $oAccount
|
||||
|
||||
### filter.http-paths
|
||||
params:
|
||||
array &$aPaths
|
||||
|
||||
### filter.http-query
|
||||
params:
|
||||
string &$sQuery
|
||||
|
||||
### filter.json-response
|
||||
params:
|
||||
string $sAction
|
||||
array &$aResponseItem
|
||||
|
||||
### filter.message-html'
|
||||
### filter.message-plain
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Mime\Message $oMessage
|
||||
string &$sTextConverted
|
||||
|
||||
### filter.message-rcpt
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Mime\EmailCollection $oRcpt
|
||||
|
||||
### filter.read-receipt-message-plain
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Mime\Message $oMessage
|
||||
string &$sText
|
||||
|
||||
### filter.result-message
|
||||
params:
|
||||
\MailSo\Mime\Message $oMessage
|
||||
|
||||
### filter.save-message
|
||||
params:
|
||||
\MailSo\Mime\Message $oMessage
|
||||
|
||||
### filter.send-message
|
||||
params:
|
||||
\MailSo\Mime\Message $oMessage
|
||||
|
||||
### filter.send-message-stream
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
resource &$rMessageStream
|
||||
int &$iMessageStreamSize
|
||||
|
||||
### filter.send-read-receipt-message
|
||||
params:
|
||||
\MailSo\Mime\Message $oMessage
|
||||
\RainLoop\Model\Account $oAccount
|
||||
|
||||
### filter.smtp-from
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Mime\Message $oMessage
|
||||
string &$sFrom
|
||||
|
||||
### filter.smtp-hidden-rcpt
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
\MailSo\Mime\Message $oMessage
|
||||
array &$aHiddenRcpt
|
||||
|
||||
### filter.smtp-message-stream
|
||||
params:
|
||||
\RainLoop\Model\Account $oAccount
|
||||
resource &$rMessageStream
|
||||
int &$iMessageStreamSize
|
||||
|
||||
### filter.upload-response
|
||||
params:
|
||||
array &$aResponseItem
|
||||
|
||||
### json.action-post-call
|
||||
params:
|
||||
string $sAction
|
||||
array &$aResponseItem
|
||||
|
||||
### json.action-post-call
|
||||
params:
|
||||
string $sAction
|
||||
array &$aResponseItem
|
||||
|
||||
### json.action-pre-call
|
||||
params:
|
||||
string $sAction
|
||||
|
||||
### json.action-pre-call
|
||||
params:
|
||||
string $sAction
|
||||
|
||||
### json.suggestions-input-parameters
|
||||
params:
|
||||
string &$sQuery
|
||||
int &$iLimit
|
||||
\RainLoop\Model\Account $oAccount
|
||||
|
||||
### json.suggestions-post
|
||||
params:
|
||||
array &$aResult
|
||||
string $sQuery
|
||||
\RainLoop\Model\Account $oAccount
|
||||
int $iLimit
|
||||
|
||||
### json.suggestions-pre
|
||||
params:
|
||||
array &$aResult
|
||||
string $sQuery
|
||||
\RainLoop\Model\Account $oAccount
|
||||
int $iLimit
|
||||
|
||||
### main.default-response
|
||||
params:
|
||||
string $sActionName
|
||||
array &$aResponseItem
|
||||
|
||||
### main.default-response
|
||||
params:
|
||||
string $sActionName
|
||||
array &$aResponseItem
|
||||
|
||||
### main.default-response
|
||||
params:
|
||||
string $sActionName
|
||||
array &$aResponseItem
|
||||
|
||||
### main.default-response-data
|
||||
params:
|
||||
string $sActionName
|
||||
mixed &$mResult
|
||||
|
||||
### main.default-response-data
|
||||
params:
|
||||
string $sActionName
|
||||
mixed &$mResult
|
||||
|
||||
### main.default-response-data
|
||||
params:
|
||||
string $sActionName
|
||||
mixed &$mResult
|
||||
|
||||
### main.default-response-error-data
|
||||
params:
|
||||
string $sActionName
|
||||
int &$iErrorCode
|
||||
string &$sErrorMessage
|
||||
|
||||
### main.fabrica
|
||||
params:
|
||||
string $sName
|
||||
mixed &$mResult
|
||||
|
||||
### service.app-delay-start-begin
|
||||
no params
|
||||
|
||||
### service.app-delay-start-end
|
||||
no params
|
|
@ -22,8 +22,8 @@ class AutoDomainGrabPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
|
||||
public function Init() : void
|
||||
{
|
||||
$this->addHook('filter.smtp-credentials', 'FilterSmtpCredentials');
|
||||
$this->addHook('filter.imap-credentials', 'FilterImapCredentials');
|
||||
$this->addHook('smtp.credentials', 'FilterSmtpCredentials');
|
||||
$this->addHook('imap.credentials', 'FilterImapCredentials');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,7 @@ class BlackListPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
|
||||
public function Init() : void
|
||||
{
|
||||
$this->addHook('filter.login-credentials', 'FilterLoginCredentials');
|
||||
$this->addHook('login.credentials', 'FilterLoginCredentials');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,7 @@ class ChangeSmtpEhloMessagePlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
|
||||
public function Init() : void
|
||||
{
|
||||
$this->addHook('filter.smtp-credentials', 'FilterSmtpCredentials');
|
||||
$this->addHook('smtp.credentials', 'FilterSmtpCredentials');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,7 @@ class CustomAuthExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
|
||||
public function Init() : void
|
||||
{
|
||||
$this->addHook('filter.login-credentials', 'FilterLoginСredentials');
|
||||
$this->addHook('login.credentials', 'FilterLoginCredentials');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,7 @@ class CustomAuthExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
*
|
||||
* @throws \RainLoop\Exceptions\ClientException
|
||||
*/
|
||||
public function FilterLoginСredentials(&$sEmail, &$sLogin, &$sPassword)
|
||||
public function FilterLoginCredentials(&$sEmail, &$sLogin, &$sPassword)
|
||||
{
|
||||
// Your custom php logic
|
||||
// You may change login credentials
|
||||
|
|
|
@ -10,7 +10,7 @@ class CustomLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
|
||||
public function Init() : void
|
||||
{
|
||||
$this->addHook('filter.login-credentials', 'FilterLoginСredentials');
|
||||
$this->addHook('login.credentials', 'FilterLoginCredentials');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ class CustomLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
*
|
||||
* @throws \RainLoop\Exceptions\ClientException
|
||||
*/
|
||||
public function FilterLoginСredentials(&$sEmail, &$sLogin, &$sPassword)
|
||||
public function FilterLoginCredentials(&$sEmail, &$sLogin, &$sPassword)
|
||||
{
|
||||
$sMapping = \trim($this->Config()->Get('plugin', 'mapping', ''));
|
||||
if (!empty($sMapping))
|
||||
|
|
|
@ -10,7 +10,7 @@ class OverrideSmtpCredentialsPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
|
||||
public function Init() : void
|
||||
{
|
||||
$this->addHook('filter.smtp-credentials', 'FilterSmtpCredentials');
|
||||
$this->addHook('smtp.credentials', 'FilterSmtpCredentials');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,7 @@ class ProxyauthLoginExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
|
||||
public function Init() : void
|
||||
{
|
||||
$this->addHook('event.login-post-login-provide', 'EventLoginPostLoginProvide');
|
||||
$this->addHook('login.success', 'EventLoginPostLoginProvide');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,7 @@ class WhiteListPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
|
||||
public function Init() : void
|
||||
{
|
||||
$this->addHook('filter.login-credentials', 'FilterLoginCredentials');
|
||||
$this->addHook('login.credentials', 'FilterLoginCredentials');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -871,7 +871,7 @@ class Actions
|
|||
}
|
||||
}
|
||||
|
||||
public function LoginProvide(string $sEmail, string $sLogin, string $sPassword, string $sSignMeToken = '', string $sClientCert = '', bool $bThrowProvideException = false): ?Model\Account
|
||||
protected function LoginProvide(string $sEmail, string $sLogin, string $sPassword, string $sSignMeToken = '', string $sClientCert = '', bool $bThrowProvideException = false): ?Model\Account
|
||||
{
|
||||
$oAccount = null;
|
||||
if (0 < \strlen($sEmail) && 0 < \strlen($sLogin) && 0 < \strlen($sPassword)) {
|
||||
|
@ -879,7 +879,7 @@ class Actions
|
|||
if ($oDomain) {
|
||||
if ($oDomain->ValidateWhiteList($sEmail, $sLogin)) {
|
||||
$oAccount = new Model\Account($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken, '', '', $sClientCert);
|
||||
$this->Plugins()->RunHook('filter.acount', array($oAccount));
|
||||
$this->Plugins()->RunHook('filter.account', array($oAccount));
|
||||
|
||||
if ($bThrowProvideException && !$oAccount) {
|
||||
throw new Exceptions\ClientException(Notifications::AuthError);
|
||||
|
@ -1419,7 +1419,7 @@ class Actions
|
|||
{
|
||||
$sInputEmail = $sEmail;
|
||||
|
||||
$this->Plugins()->RunHook('filter.login-credentials.step-1', array(&$sEmail, &$sPassword));
|
||||
$this->Plugins()->RunHook('login.credentials.step-1', array(&$sEmail));
|
||||
|
||||
$sEmail = \MailSo\Base\Utils::Trim($sEmail);
|
||||
if ($this->Config()->Get('login', 'login_lowercase', true)) {
|
||||
|
@ -1486,7 +1486,7 @@ class Actions
|
|||
}
|
||||
}
|
||||
|
||||
$this->Plugins()->RunHook('filter.login-credentials.step-2', array(&$sEmail, &$sPassword));
|
||||
$this->Plugins()->RunHook('login.credentials.step-2', array(&$sEmail, &$sPassword));
|
||||
|
||||
if (false === \strpos($sEmail, '@') || 0 === \strlen($sPassword)) {
|
||||
$this->loginErrorDelay();
|
||||
|
@ -1501,12 +1501,10 @@ class Actions
|
|||
$sLogin = \MailSo\Base\Utils::StrToLowerIfAscii($sLogin);
|
||||
}
|
||||
|
||||
$this->Plugins()->RunHook('filter.login-credentials', array(&$sEmail, &$sLogin, &$sPassword));
|
||||
$this->Plugins()->RunHook('login.credentials', array(&$sEmail, &$sLogin, &$sPassword));
|
||||
|
||||
$this->Logger()->AddSecret($sPassword);
|
||||
|
||||
$this->Plugins()->RunHook('event.login-pre-login-provide', array());
|
||||
|
||||
$oAccount = null;
|
||||
$sClientCert = \trim($this->Config()->Get('ssl', 'client_cert', ''));
|
||||
try {
|
||||
|
@ -1516,7 +1514,7 @@ class Actions
|
|||
throw new Exceptions\ClientException(Notifications::AuthError);
|
||||
}
|
||||
|
||||
$this->Plugins()->RunHook('event.login-post-login-provide', array($oAccount));
|
||||
$this->Plugins()->RunHook('login.success', array($oAccount));
|
||||
} catch (\Throwable $oException) {
|
||||
$this->loginErrorDelay();
|
||||
$this->LoggerAuthHelper($oAccount, $this->getAdditionalLogParamsByUserLogin($sInputEmail));
|
||||
|
|
|
@ -14,28 +14,22 @@ trait Folders
|
|||
{
|
||||
$oAccount = $this->initMailClientConnection();
|
||||
|
||||
$oFolderCollection = null;
|
||||
$this->Plugins()->RunHook('filter.folders-before', array($oAccount, $oFolderCollection));
|
||||
|
||||
$HideUnsubscribed = $this->Config()->Get('labs', 'use_imap_list_subscribe', true);
|
||||
$oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
|
||||
if ($oSettingsLocal instanceof \RainLoop\Settings) {
|
||||
$HideUnsubscribed = (bool) $oSettingsLocal->GetConf('HideUnsubscribed', $HideUnsubscribed);
|
||||
}
|
||||
|
||||
if (null === $oFolderCollection)
|
||||
{
|
||||
$oFolderCollection = $this->MailClient()->Folders('',
|
||||
'*',
|
||||
$HideUnsubscribed,
|
||||
(int) $this->Config()->Get('labs', 'imap_folder_list_limit', 200)
|
||||
);
|
||||
}
|
||||
|
||||
$this->Plugins()->RunHook('filter.folders-post', array($oAccount, $oFolderCollection));
|
||||
$oFolderCollection = $this->MailClient()->Folders('',
|
||||
'*',
|
||||
$HideUnsubscribed,
|
||||
(int) $this->Config()->Get('labs', 'imap_folder_list_limit', 200)
|
||||
);
|
||||
|
||||
if ($oFolderCollection instanceof \MailSo\Mail\FolderCollection)
|
||||
{
|
||||
$this->Plugins()->RunHook('filter.folders-post', array($oAccount, $oFolderCollection));
|
||||
|
||||
$aFolders = $oFolderCollection->getArrayCopy();
|
||||
foreach ($aFolders as $i => $oFolder) {
|
||||
if (!$oFolder->IsSelectable()) {
|
||||
|
@ -158,9 +152,9 @@ trait Folders
|
|||
{
|
||||
$oFolderCollection->FoldersHash = \md5(\implode("\x0", $this->recFoldersNames($oFolderCollection)));
|
||||
}
|
||||
}
|
||||
|
||||
$this->Plugins()->RunHook('filter.folders-complete', array($oAccount, $oFolderCollection));
|
||||
$this->Plugins()->RunHook('filter.folders-complete', array($oAccount, $oFolderCollection));
|
||||
}
|
||||
|
||||
return $this->DefaultResponse(__FUNCTION__, $oFolderCollection);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ namespace RainLoop\Enumerations;
|
|||
|
||||
class Capa
|
||||
{
|
||||
const PREM = 'PREM';
|
||||
const OPEN_PGP = 'OPEN_PGP';
|
||||
const PREFETCH = 'PREFETCH';
|
||||
const THEMES = 'THEMES';
|
||||
|
|
|
@ -285,21 +285,18 @@ class Account
|
|||
|
||||
$oPlugins->RunHook('filter.imap-credentials', array($this, &$aImapCredentials));
|
||||
|
||||
$oPlugins->RunHook('event.imap-pre-connect', array($this, $aImapCredentials['UseConnect'], $aImapCredentials));
|
||||
|
||||
if ($aImapCredentials['UseConnect'])
|
||||
{
|
||||
$oPlugins->RunHook('imap.before-connect', array($this, $oMailClient, $aImapCredentials));
|
||||
if ($aImapCredentials['UseConnect']) {
|
||||
$oMailClient
|
||||
->Connect($aImapCredentials['Host'], $aImapCredentials['Port'],
|
||||
$aImapCredentials['Secure'], $aImapCredentials['VerifySsl'],
|
||||
$aImapCredentials['AllowSelfSigned'], $aImapCredentials['ClientCert']);
|
||||
|
||||
}
|
||||
$oPlugins->RunHook('imap.after-connect', array($this, $oMailClient, $aImapCredentials));
|
||||
|
||||
$oPlugins->RunHook('event.imap-pre-login', array($this, $aImapCredentials['UseAuth'], $aImapCredentials));
|
||||
|
||||
if ($aImapCredentials['UseAuth'])
|
||||
{
|
||||
$oPlugins->RunHook('imap.before-login', array($this, $oMailClient, $aImapCredentials));
|
||||
if ($aImapCredentials['UseAuth']) {
|
||||
if (0 < \strlen($aImapCredentials['ProxyAuthUser']) &&
|
||||
0 < \strlen($aImapCredentials['ProxyAuthPassword']))
|
||||
{
|
||||
|
@ -315,8 +312,7 @@ class Account
|
|||
|
||||
$bLogin = true;
|
||||
}
|
||||
|
||||
$oPlugins->RunHook('event.imap-post-login', array($this, $aImapCredentials['UseAuth'], $bLogin, $aImapCredentials));
|
||||
$oPlugins->RunHook('imap.after-login', array($this, $oMailClient, $bLogin, $aImapCredentials));
|
||||
|
||||
return $bLogin;
|
||||
}
|
||||
|
@ -326,7 +322,7 @@ class Account
|
|||
$bLogin = false;
|
||||
|
||||
$aSmtpCredentials = array(
|
||||
'UseConnect' => true,
|
||||
'UseConnect' => !$bUsePhpMail,
|
||||
'UseAuth' => $this->DomainOutAuth(),
|
||||
'UsePhpMail' => $bUsePhpMail,
|
||||
'Ehlo' => \MailSo\Smtp\SmtpClient::EhloHelper(),
|
||||
|
@ -343,23 +339,20 @@ class Account
|
|||
'UseAuthCramMd5IfSupported' => !!$oConfig->Get('labs', 'smtp_use_auth_cram_md5', true)
|
||||
);
|
||||
|
||||
$oPlugins->RunHook('filter.smtp-credentials', array($this, &$aSmtpCredentials));
|
||||
$oPlugins->RunHook('smtp.credentials', array($this, &$aSmtpCredentials));
|
||||
|
||||
$bUsePhpMail = $aSmtpCredentials['UsePhpMail'];
|
||||
|
||||
$oPlugins->RunHook('event.smtp-pre-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials));
|
||||
|
||||
if ($aSmtpCredentials['UseConnect'] && !$aSmtpCredentials['UsePhpMail'] && $oSmtpClient)
|
||||
{
|
||||
$oPlugins->RunHook('smtp.before-connect', array($this, $oSmtpClient, $aSmtpCredentials));
|
||||
if ($aSmtpCredentials['UseConnect']) {
|
||||
$oSmtpClient->Connect($aSmtpCredentials['Host'], $aSmtpCredentials['Port'],
|
||||
$aSmtpCredentials['Secure'], $aSmtpCredentials['VerifySsl'], $aSmtpCredentials['AllowSelfSigned'],
|
||||
'', $aSmtpCredentials['Ehlo']
|
||||
);
|
||||
}
|
||||
$oPlugins->RunHook('smtp.after-connect', array($this, $oSmtpClient, $aSmtpCredentials));
|
||||
|
||||
$oPlugins->RunHook('event.smtp-post-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials));
|
||||
$oPlugins->RunHook('event.smtp-pre-login', array($this, $aSmtpCredentials['UseAuth'], $aSmtpCredentials));
|
||||
|
||||
$oPlugins->RunHook('smtp.before-login', array($this, $oSmtpClient, $aSmtpCredentials));
|
||||
if ($aSmtpCredentials['UseAuth'] && !$aSmtpCredentials['UsePhpMail'] && $oSmtpClient)
|
||||
{
|
||||
$oSmtpClient->Login($aSmtpCredentials['Login'], $aSmtpCredentials['Password'],
|
||||
|
@ -367,8 +360,7 @@ class Account
|
|||
|
||||
$bLogin = true;
|
||||
}
|
||||
|
||||
$oPlugins->RunHook('event.smtp-post-login', array($this, $aSmtpCredentials['UseAuth'], $bLogin, $aSmtpCredentials));
|
||||
$oPlugins->RunHook('smtp.after-login', array($this, $oSmtpClient, $bLogin, $aSmtpCredentials));
|
||||
|
||||
return $bLogin;
|
||||
}
|
||||
|
@ -390,34 +382,24 @@ class Account
|
|||
'InitialAuthPlain' => !!$oConfig->Get('ssl', 'sieve_auth_plain_initial', true)
|
||||
);
|
||||
|
||||
$oPlugins->RunHook('filter.sieve-credentials', array($this, &$aSieveCredentials));
|
||||
$oPlugins->RunHook('sieve.credentials', array($this, &$aSieveCredentials));
|
||||
|
||||
$oPlugins->RunHook('event.sieve-pre-connect', array($this, $aSieveCredentials['UseConnect'], $aSieveCredentials));
|
||||
$oSieveClient->__USE_INITIAL_AUTH_PLAIN_COMMAND = $aSieveCredentials['InitialAuthPlain'];
|
||||
|
||||
if ($oSieveClient)
|
||||
{
|
||||
$oSieveClient->__USE_INITIAL_AUTH_PLAIN_COMMAND = $aSieveCredentials['InitialAuthPlain'];
|
||||
|
||||
if ($aSieveCredentials['UseConnect'])
|
||||
{
|
||||
$oSieveClient->Connect($aSieveCredentials['Host'], $aSieveCredentials['Port'],
|
||||
$aSieveCredentials['Secure'], $aSieveCredentials['VerifySsl'], $aSieveCredentials['AllowSelfSigned']
|
||||
);
|
||||
}
|
||||
$oPlugins->RunHook('sieve.before-connect', array($this, $oSieveClient, $aSieveCredentials));
|
||||
if ($aSieveCredentials['UseConnect']) {
|
||||
$oSieveClient->Connect($aSieveCredentials['Host'], $aSieveCredentials['Port'],
|
||||
$aSieveCredentials['Secure'], $aSieveCredentials['VerifySsl'], $aSieveCredentials['AllowSelfSigned']
|
||||
);
|
||||
}
|
||||
$oPlugins->RunHook('sieve.after-connect', array($this, $oSieveClient, $aSieveCredentials));
|
||||
|
||||
$oPlugins->RunHook('event.sieve-post-connect', array($this, $aSieveCredentials['UseConnect'], $aSieveCredentials));
|
||||
|
||||
$oPlugins->RunHook('event.sieve-pre-login', array($this, $aSieveCredentials['UseAuth'], $aSieveCredentials));
|
||||
|
||||
if ($aSieveCredentials['UseAuth'])
|
||||
{
|
||||
$oPlugins->RunHook('event.sieve-pre-login', array($this, $oSieveClient, $aSieveCredentials));
|
||||
if ($aSieveCredentials['UseAuth']) {
|
||||
$oSieveClient->Login($aSieveCredentials['Login'], $aSieveCredentials['Password']);
|
||||
|
||||
$bLogin = true;
|
||||
}
|
||||
|
||||
$oPlugins->RunHook('event.sieve-post-login', array($this, $aSieveCredentials['UseAuth'], $bLogin, $aSieveCredentials));
|
||||
$oPlugins->RunHook('sieve.after-login', array($this, $oSieveClient, $bLogin, $aSieveCredentials));
|
||||
|
||||
return $bLogin;
|
||||
}
|
||||
|
|
|
@ -57,8 +57,6 @@ class Manager
|
|||
$oConfig->Save();
|
||||
}
|
||||
}
|
||||
|
||||
$this->RunHook('api.bootstrap.plugins');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue