mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 15:45:55 +08:00
Sieve test connection
This commit is contained in:
parent
b563528be7
commit
63a286a6b6
7
dev/External/ko.js
vendored
7
dev/External/ko.js
vendored
|
@ -114,6 +114,13 @@
|
|||
else
|
||||
{
|
||||
$(oElement).data('tooltip3-data', sValue).tooltip('show');
|
||||
|
||||
_.delay(function () {
|
||||
if ($(oElement).is(':visible'))
|
||||
{
|
||||
$(oElement).tooltip('show');
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -30,14 +30,14 @@
|
|||
}
|
||||
|
||||
.testing-done {
|
||||
.imap-header, .smtp-header {
|
||||
&.imap-header, &.sieve-header, &.smtp-header {
|
||||
color: green;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.testing-error {
|
||||
.imap-header, .smtp-header {
|
||||
&.imap-header, &.sieve-header, &.smtp-header {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,8 +36,10 @@
|
|||
this.testing = ko.observable(false);
|
||||
this.testingDone = ko.observable(false);
|
||||
this.testingImapError = ko.observable(false);
|
||||
this.testingSieveError = ko.observable(false);
|
||||
this.testingSmtpError = ko.observable(false);
|
||||
this.testingImapErrorDesc = ko.observable('');
|
||||
this.testingSieveErrorDesc = ko.observable('');
|
||||
this.testingSmtpErrorDesc = ko.observable('');
|
||||
|
||||
this.testingImapError.subscribe(function (bValue) {
|
||||
|
@ -47,6 +49,13 @@
|
|||
}
|
||||
}, this);
|
||||
|
||||
this.testingSieveError.subscribe(function (bValue) {
|
||||
if (!bValue)
|
||||
{
|
||||
this.testingSieveErrorDesc('');
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.testingSmtpError.subscribe(function (bValue) {
|
||||
if (!bValue)
|
||||
{
|
||||
|
@ -54,9 +63,6 @@
|
|||
}
|
||||
}, this);
|
||||
|
||||
this.testingImapErrorDesc = ko.observable('');
|
||||
this.testingSmtpErrorDesc = ko.observable('');
|
||||
|
||||
this.imapServerFocus = ko.observable(false);
|
||||
this.sieveServerFocus = ko.observable(false);
|
||||
this.smtpServerFocus = ko.observable(false);
|
||||
|
@ -147,7 +153,6 @@
|
|||
this.testConnectionCommand = Utils.createCommand(this, function () {
|
||||
|
||||
this.page('main');
|
||||
this.sieveSettings(false);
|
||||
|
||||
this.testingDone(false);
|
||||
this.testingImapError(false);
|
||||
|
@ -277,12 +282,19 @@
|
|||
this.testing(false);
|
||||
if (Enums.StorageResultType.Success === sResult && oData.Result)
|
||||
{
|
||||
var
|
||||
bImap = false,
|
||||
bSieve = false
|
||||
;
|
||||
|
||||
this.testingDone(true);
|
||||
this.testingImapError(true !== oData.Result.Imap);
|
||||
this.testingSmtpError(true !== oData.Result.Smtp);
|
||||
this.testingSieveError(true !== oData.Result.Sieve);
|
||||
|
||||
if (this.testingImapError() && oData.Result.Imap)
|
||||
{
|
||||
bImap = true;
|
||||
this.testingImapErrorDesc(oData.Result.Imap);
|
||||
}
|
||||
|
||||
|
@ -290,11 +302,28 @@
|
|||
{
|
||||
this.testingSmtpErrorDesc(oData.Result.Smtp);
|
||||
}
|
||||
|
||||
if (this.testingSieveError() && oData.Result.Sieve)
|
||||
{
|
||||
bSieve = true;
|
||||
this.testingSieveErrorDesc(oData.Result.Sieve);
|
||||
}
|
||||
|
||||
if (bImap)
|
||||
{
|
||||
this.sieveSettings(false);
|
||||
}
|
||||
else if (bSieve)
|
||||
{
|
||||
this.sieveSettings(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.testingImapError(true);
|
||||
this.testingSmtpError(true);
|
||||
this.testingSieveError(true);
|
||||
this.sieveSettings(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -325,6 +354,7 @@
|
|||
this.testingDone(false);
|
||||
this.testingImapError(false);
|
||||
this.testingSmtpError(false);
|
||||
this.testingSieveError(false);
|
||||
};
|
||||
|
||||
DomainPopupView.prototype.onHide = function ()
|
||||
|
|
|
@ -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
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue