Sieve test connection

This commit is contained in:
RainLoop Team 2015-01-28 20:27:23 +04:00
parent b563528be7
commit 63a286a6b6
5 changed files with 88 additions and 12 deletions

View file

@ -3150,9 +3150,12 @@ class Actions
$sImapErrorDesc = '';
$bSmtpResult = false;
$sSmtpErrorDesc = '';
$bSieveResult = false;
$sSieveErrorDesc = '';
$iImapTime = 0;
$iSmtpTime = 0;
$iSieveTime = 0;
$iConnectionTimeout = 5;
@ -3230,11 +3233,42 @@ class Actions
$sSmtpErrorDesc = $oException->getMessage();
}
}
try
{
$oSieveClient = \MailSo\Sieve\ManageSieveClient::NewInstance()->SetLogger($this->Logger());
$oSieveClient->SetTimeOuts($iConnectionTimeout);
$iTime = \microtime(true);
$oSieveClient->Connect($oDomain->SieveHost(), $oDomain->SievePort(), $oDomain->SieveSecure(),
!!$this->Config()->Get('ssl', 'verify_certificate', false),
!!$this->Config()->Get('ssl', 'allow_self_signed', true)
);
$iSieveTime = \microtime(true) - $iTime;
$oSieveClient->Disconnect();
$bSieveResult = true;
}
catch (\MailSo\Net\Exceptions\SocketCanNotConnectToHostException $oException)
{
$this->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
$sSieveErrorDesc = $oException->getSocketMessage();
if (empty($sSieveErrorDesc))
{
$sSieveErrorDesc = $oException->getMessage();
}
}
catch (\Exception $oException)
{
$this->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
$sSieveErrorDesc = $oException->getMessage();
}
}
return $this->DefaultResponse(__FUNCTION__, array(
'Imap' => $bImapResult ? true : $sImapErrorDesc,
'Smtp' => $bSmtpResult ? true : $sSmtpErrorDesc
'Smtp' => $bSmtpResult ? true : $sSmtpErrorDesc,
'Sieve' => $bSieveResult ? true : $sSieveErrorDesc
));
}

View file

@ -18,10 +18,15 @@
</div>
</div>
<div class="row">
<div class="span5" data-bind="css: { 'testing-done': testingDone, 'testing-error': testingImapError }">
<div class="legend imap-header">
<div class="span5">
<div class="legend imap-header" data-bind="visible: !sieveSettings(), css: { 'testing-done': testingDone, 'testing-error': testingImapError }">
<span data-placement="bottom" data-bind="tooltipForTest: testingImapErrorDesc">
<span data-bind="text: sieveSettings() ? 'SIEVE' : 'IMAP'">IMAP</span>
IMAP
</span>
</div>
<div class="legend sieve-header" data-bind="visible: sieveSettings(), css: { 'testing-done': testingDone, 'testing-error': testingSieveError }">
<span data-placement="bottom" data-bind="tooltipForTest: testingSieveErrorDesc">
SIEVE
</span>
</div>
<div data-bind="visible: !sieveSettings()">
@ -144,8 +149,8 @@
</div>
</div>
</div>
<div class="span5" data-bind="css: { 'testing-done': testingDone, 'testing-error': testingSmtpError }">
<div class="legend smtp-header">
<div class="span5">
<div class="legend smtp-header" data-bind="css: { 'testing-done': testingDone, 'testing-error': testingSmtpError }">
<span data-placement="bottom" data-bind="tooltipForTest: testingSmtpErrorDesc">
SMTP
</span>