Change and document plugins hook system

This commit is contained in:
djmaze 2021-04-14 14:30:42 +02:00
parent 3c8d01a882
commit e112d1fd70
14 changed files with 395 additions and 79 deletions

345
plugins/README.md Normal file
View 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

View file

@ -22,8 +22,8 @@ class AutoDomainGrabPlugin extends \RainLoop\Plugins\AbstractPlugin
public function Init() : void public function Init() : void
{ {
$this->addHook('filter.smtp-credentials', 'FilterSmtpCredentials'); $this->addHook('smtp.credentials', 'FilterSmtpCredentials');
$this->addHook('filter.imap-credentials', 'FilterImapCredentials'); $this->addHook('imap.credentials', 'FilterImapCredentials');
} }
/** /**

View file

@ -10,7 +10,7 @@ class BlackListPlugin extends \RainLoop\Plugins\AbstractPlugin
public function Init() : void public function Init() : void
{ {
$this->addHook('filter.login-credentials', 'FilterLoginCredentials'); $this->addHook('login.credentials', 'FilterLoginCredentials');
} }
/** /**

View file

@ -9,7 +9,7 @@ class ChangeSmtpEhloMessagePlugin extends \RainLoop\Plugins\AbstractPlugin
public function Init() : void public function Init() : void
{ {
$this->addHook('filter.smtp-credentials', 'FilterSmtpCredentials'); $this->addHook('smtp.credentials', 'FilterSmtpCredentials');
} }
/** /**

View file

@ -9,7 +9,7 @@ class CustomAuthExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
public function Init() : void 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 * @throws \RainLoop\Exceptions\ClientException
*/ */
public function FilterLoginСredentials(&$sEmail, &$sLogin, &$sPassword) public function FilterLoginCredentials(&$sEmail, &$sLogin, &$sPassword)
{ {
// Your custom php logic // Your custom php logic
// You may change login credentials // You may change login credentials

View file

@ -10,7 +10,7 @@ class CustomLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin
public function Init() : void 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 * @throws \RainLoop\Exceptions\ClientException
*/ */
public function FilterLoginСredentials(&$sEmail, &$sLogin, &$sPassword) public function FilterLoginCredentials(&$sEmail, &$sLogin, &$sPassword)
{ {
$sMapping = \trim($this->Config()->Get('plugin', 'mapping', '')); $sMapping = \trim($this->Config()->Get('plugin', 'mapping', ''));
if (!empty($sMapping)) if (!empty($sMapping))

View file

@ -10,7 +10,7 @@ class OverrideSmtpCredentialsPlugin extends \RainLoop\Plugins\AbstractPlugin
public function Init() : void public function Init() : void
{ {
$this->addHook('filter.smtp-credentials', 'FilterSmtpCredentials'); $this->addHook('smtp.credentials', 'FilterSmtpCredentials');
} }
/** /**

View file

@ -9,7 +9,7 @@ class ProxyauthLoginExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
public function Init() : void public function Init() : void
{ {
$this->addHook('event.login-post-login-provide', 'EventLoginPostLoginProvide'); $this->addHook('login.success', 'EventLoginPostLoginProvide');
} }
/** /**

View file

@ -10,7 +10,7 @@ class WhiteListPlugin extends \RainLoop\Plugins\AbstractPlugin
public function Init() : void public function Init() : void
{ {
$this->addHook('filter.login-credentials', 'FilterLoginCredentials'); $this->addHook('login.credentials', 'FilterLoginCredentials');
} }
/** /**

View file

@ -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; $oAccount = null;
if (0 < \strlen($sEmail) && 0 < \strlen($sLogin) && 0 < \strlen($sPassword)) { if (0 < \strlen($sEmail) && 0 < \strlen($sLogin) && 0 < \strlen($sPassword)) {
@ -879,7 +879,7 @@ class Actions
if ($oDomain) { if ($oDomain) {
if ($oDomain->ValidateWhiteList($sEmail, $sLogin)) { if ($oDomain->ValidateWhiteList($sEmail, $sLogin)) {
$oAccount = new Model\Account($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken, '', '', $sClientCert); $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) { if ($bThrowProvideException && !$oAccount) {
throw new Exceptions\ClientException(Notifications::AuthError); throw new Exceptions\ClientException(Notifications::AuthError);
@ -1419,7 +1419,7 @@ class Actions
{ {
$sInputEmail = $sEmail; $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); $sEmail = \MailSo\Base\Utils::Trim($sEmail);
if ($this->Config()->Get('login', 'login_lowercase', true)) { 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)) { if (false === \strpos($sEmail, '@') || 0 === \strlen($sPassword)) {
$this->loginErrorDelay(); $this->loginErrorDelay();
@ -1501,12 +1501,10 @@ class Actions
$sLogin = \MailSo\Base\Utils::StrToLowerIfAscii($sLogin); $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->Logger()->AddSecret($sPassword);
$this->Plugins()->RunHook('event.login-pre-login-provide', array());
$oAccount = null; $oAccount = null;
$sClientCert = \trim($this->Config()->Get('ssl', 'client_cert', '')); $sClientCert = \trim($this->Config()->Get('ssl', 'client_cert', ''));
try { try {
@ -1516,7 +1514,7 @@ class Actions
throw new Exceptions\ClientException(Notifications::AuthError); 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) { } catch (\Throwable $oException) {
$this->loginErrorDelay(); $this->loginErrorDelay();
$this->LoggerAuthHelper($oAccount, $this->getAdditionalLogParamsByUserLogin($sInputEmail)); $this->LoggerAuthHelper($oAccount, $this->getAdditionalLogParamsByUserLogin($sInputEmail));

View file

@ -14,28 +14,22 @@ trait Folders
{ {
$oAccount = $this->initMailClientConnection(); $oAccount = $this->initMailClientConnection();
$oFolderCollection = null;
$this->Plugins()->RunHook('filter.folders-before', array($oAccount, $oFolderCollection));
$HideUnsubscribed = $this->Config()->Get('labs', 'use_imap_list_subscribe', true); $HideUnsubscribed = $this->Config()->Get('labs', 'use_imap_list_subscribe', true);
$oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount); $oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
if ($oSettingsLocal instanceof \RainLoop\Settings) { if ($oSettingsLocal instanceof \RainLoop\Settings) {
$HideUnsubscribed = (bool) $oSettingsLocal->GetConf('HideUnsubscribed', $HideUnsubscribed); $HideUnsubscribed = (bool) $oSettingsLocal->GetConf('HideUnsubscribed', $HideUnsubscribed);
} }
if (null === $oFolderCollection)
{
$oFolderCollection = $this->MailClient()->Folders('', $oFolderCollection = $this->MailClient()->Folders('',
'*', '*',
$HideUnsubscribed, $HideUnsubscribed,
(int) $this->Config()->Get('labs', 'imap_folder_list_limit', 200) (int) $this->Config()->Get('labs', 'imap_folder_list_limit', 200)
); );
}
$this->Plugins()->RunHook('filter.folders-post', array($oAccount, $oFolderCollection));
if ($oFolderCollection instanceof \MailSo\Mail\FolderCollection) if ($oFolderCollection instanceof \MailSo\Mail\FolderCollection)
{ {
$this->Plugins()->RunHook('filter.folders-post', array($oAccount, $oFolderCollection));
$aFolders = $oFolderCollection->getArrayCopy(); $aFolders = $oFolderCollection->getArrayCopy();
foreach ($aFolders as $i => $oFolder) { foreach ($aFolders as $i => $oFolder) {
if (!$oFolder->IsSelectable()) { if (!$oFolder->IsSelectable()) {
@ -158,9 +152,9 @@ trait Folders
{ {
$oFolderCollection->FoldersHash = \md5(\implode("\x0", $this->recFoldersNames($oFolderCollection))); $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); return $this->DefaultResponse(__FUNCTION__, $oFolderCollection);
} }

View file

@ -4,7 +4,6 @@ namespace RainLoop\Enumerations;
class Capa class Capa
{ {
const PREM = 'PREM';
const OPEN_PGP = 'OPEN_PGP'; const OPEN_PGP = 'OPEN_PGP';
const PREFETCH = 'PREFETCH'; const PREFETCH = 'PREFETCH';
const THEMES = 'THEMES'; const THEMES = 'THEMES';

View file

@ -285,21 +285,18 @@ class Account
$oPlugins->RunHook('filter.imap-credentials', array($this, &$aImapCredentials)); $oPlugins->RunHook('filter.imap-credentials', array($this, &$aImapCredentials));
$oPlugins->RunHook('event.imap-pre-connect', array($this, $aImapCredentials['UseConnect'], $aImapCredentials)); $oPlugins->RunHook('imap.before-connect', array($this, $oMailClient, $aImapCredentials));
if ($aImapCredentials['UseConnect']) {
if ($aImapCredentials['UseConnect'])
{
$oMailClient $oMailClient
->Connect($aImapCredentials['Host'], $aImapCredentials['Port'], ->Connect($aImapCredentials['Host'], $aImapCredentials['Port'],
$aImapCredentials['Secure'], $aImapCredentials['VerifySsl'], $aImapCredentials['Secure'], $aImapCredentials['VerifySsl'],
$aImapCredentials['AllowSelfSigned'], $aImapCredentials['ClientCert']); $aImapCredentials['AllowSelfSigned'], $aImapCredentials['ClientCert']);
} }
$oPlugins->RunHook('imap.after-connect', array($this, $oMailClient, $aImapCredentials));
$oPlugins->RunHook('event.imap-pre-login', array($this, $aImapCredentials['UseAuth'], $aImapCredentials)); $oPlugins->RunHook('imap.before-login', array($this, $oMailClient, $aImapCredentials));
if ($aImapCredentials['UseAuth']) {
if ($aImapCredentials['UseAuth'])
{
if (0 < \strlen($aImapCredentials['ProxyAuthUser']) && if (0 < \strlen($aImapCredentials['ProxyAuthUser']) &&
0 < \strlen($aImapCredentials['ProxyAuthPassword'])) 0 < \strlen($aImapCredentials['ProxyAuthPassword']))
{ {
@ -315,8 +312,7 @@ class Account
$bLogin = true; $bLogin = true;
} }
$oPlugins->RunHook('imap.after-login', array($this, $oMailClient, $bLogin, $aImapCredentials));
$oPlugins->RunHook('event.imap-post-login', array($this, $aImapCredentials['UseAuth'], $bLogin, $aImapCredentials));
return $bLogin; return $bLogin;
} }
@ -326,7 +322,7 @@ class Account
$bLogin = false; $bLogin = false;
$aSmtpCredentials = array( $aSmtpCredentials = array(
'UseConnect' => true, 'UseConnect' => !$bUsePhpMail,
'UseAuth' => $this->DomainOutAuth(), 'UseAuth' => $this->DomainOutAuth(),
'UsePhpMail' => $bUsePhpMail, 'UsePhpMail' => $bUsePhpMail,
'Ehlo' => \MailSo\Smtp\SmtpClient::EhloHelper(), 'Ehlo' => \MailSo\Smtp\SmtpClient::EhloHelper(),
@ -343,23 +339,20 @@ class Account
'UseAuthCramMd5IfSupported' => !!$oConfig->Get('labs', 'smtp_use_auth_cram_md5', true) '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']; $bUsePhpMail = $aSmtpCredentials['UsePhpMail'];
$oPlugins->RunHook('event.smtp-pre-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials)); $oPlugins->RunHook('smtp.before-connect', array($this, $oSmtpClient, $aSmtpCredentials));
if ($aSmtpCredentials['UseConnect']) {
if ($aSmtpCredentials['UseConnect'] && !$aSmtpCredentials['UsePhpMail'] && $oSmtpClient)
{
$oSmtpClient->Connect($aSmtpCredentials['Host'], $aSmtpCredentials['Port'], $oSmtpClient->Connect($aSmtpCredentials['Host'], $aSmtpCredentials['Port'],
$aSmtpCredentials['Secure'], $aSmtpCredentials['VerifySsl'], $aSmtpCredentials['AllowSelfSigned'], $aSmtpCredentials['Secure'], $aSmtpCredentials['VerifySsl'], $aSmtpCredentials['AllowSelfSigned'],
'', $aSmtpCredentials['Ehlo'] '', $aSmtpCredentials['Ehlo']
); );
} }
$oPlugins->RunHook('smtp.after-connect', array($this, $oSmtpClient, $aSmtpCredentials));
$oPlugins->RunHook('event.smtp-post-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials)); $oPlugins->RunHook('smtp.before-login', array($this, $oSmtpClient, $aSmtpCredentials));
$oPlugins->RunHook('event.smtp-pre-login', array($this, $aSmtpCredentials['UseAuth'], $aSmtpCredentials));
if ($aSmtpCredentials['UseAuth'] && !$aSmtpCredentials['UsePhpMail'] && $oSmtpClient) if ($aSmtpCredentials['UseAuth'] && !$aSmtpCredentials['UsePhpMail'] && $oSmtpClient)
{ {
$oSmtpClient->Login($aSmtpCredentials['Login'], $aSmtpCredentials['Password'], $oSmtpClient->Login($aSmtpCredentials['Login'], $aSmtpCredentials['Password'],
@ -367,8 +360,7 @@ class Account
$bLogin = true; $bLogin = true;
} }
$oPlugins->RunHook('smtp.after-login', array($this, $oSmtpClient, $bLogin, $aSmtpCredentials));
$oPlugins->RunHook('event.smtp-post-login', array($this, $aSmtpCredentials['UseAuth'], $bLogin, $aSmtpCredentials));
return $bLogin; return $bLogin;
} }
@ -390,34 +382,24 @@ class Account
'InitialAuthPlain' => !!$oConfig->Get('ssl', 'sieve_auth_plain_initial', true) '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));
if ($oSieveClient)
{
$oSieveClient->__USE_INITIAL_AUTH_PLAIN_COMMAND = $aSieveCredentials['InitialAuthPlain']; $oSieveClient->__USE_INITIAL_AUTH_PLAIN_COMMAND = $aSieveCredentials['InitialAuthPlain'];
if ($aSieveCredentials['UseConnect']) $oPlugins->RunHook('sieve.before-connect', array($this, $oSieveClient, $aSieveCredentials));
{ if ($aSieveCredentials['UseConnect']) {
$oSieveClient->Connect($aSieveCredentials['Host'], $aSieveCredentials['Port'], $oSieveClient->Connect($aSieveCredentials['Host'], $aSieveCredentials['Port'],
$aSieveCredentials['Secure'], $aSieveCredentials['VerifySsl'], $aSieveCredentials['AllowSelfSigned'] $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, $oSieveClient, $aSieveCredentials));
if ($aSieveCredentials['UseAuth']) {
$oPlugins->RunHook('event.sieve-pre-login', array($this, $aSieveCredentials['UseAuth'], $aSieveCredentials));
if ($aSieveCredentials['UseAuth'])
{
$oSieveClient->Login($aSieveCredentials['Login'], $aSieveCredentials['Password']); $oSieveClient->Login($aSieveCredentials['Login'], $aSieveCredentials['Password']);
$bLogin = true; $bLogin = true;
} }
$oPlugins->RunHook('sieve.after-login', array($this, $oSieveClient, $bLogin, $aSieveCredentials));
$oPlugins->RunHook('event.sieve-post-login', array($this, $aSieveCredentials['UseAuth'], $bLogin, $aSieveCredentials));
return $bLogin; return $bLogin;
} }

View file

@ -57,8 +57,6 @@ class Manager
$oConfig->Save(); $oConfig->Save();
} }
} }
$this->RunHook('api.bootstrap.plugins');
} }
} }