mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Sieve test connection
This commit is contained in:
parent
b563528be7
commit
63a286a6b6
5 changed files with 88 additions and 12 deletions
7
dev/External/ko.js
vendored
7
dev/External/ko.js
vendored
|
|
@ -114,6 +114,13 @@
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$(oElement).data('tooltip3-data', sValue).tooltip('show');
|
$(oElement).data('tooltip3-data', sValue).tooltip('show');
|
||||||
|
|
||||||
|
_.delay(function () {
|
||||||
|
if ($(oElement).is(':visible'))
|
||||||
|
{
|
||||||
|
$(oElement).tooltip('show');
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.testing-done {
|
.testing-done {
|
||||||
.imap-header, .smtp-header {
|
&.imap-header, &.sieve-header, &.smtp-header {
|
||||||
color: green;
|
color: green;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.testing-error {
|
.testing-error {
|
||||||
.imap-header, .smtp-header {
|
&.imap-header, &.sieve-header, &.smtp-header {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,10 @@
|
||||||
this.testing = ko.observable(false);
|
this.testing = ko.observable(false);
|
||||||
this.testingDone = ko.observable(false);
|
this.testingDone = ko.observable(false);
|
||||||
this.testingImapError = ko.observable(false);
|
this.testingImapError = ko.observable(false);
|
||||||
|
this.testingSieveError = ko.observable(false);
|
||||||
this.testingSmtpError = ko.observable(false);
|
this.testingSmtpError = ko.observable(false);
|
||||||
this.testingImapErrorDesc = ko.observable('');
|
this.testingImapErrorDesc = ko.observable('');
|
||||||
|
this.testingSieveErrorDesc = ko.observable('');
|
||||||
this.testingSmtpErrorDesc = ko.observable('');
|
this.testingSmtpErrorDesc = ko.observable('');
|
||||||
|
|
||||||
this.testingImapError.subscribe(function (bValue) {
|
this.testingImapError.subscribe(function (bValue) {
|
||||||
|
|
@ -47,6 +49,13 @@
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
this.testingSieveError.subscribe(function (bValue) {
|
||||||
|
if (!bValue)
|
||||||
|
{
|
||||||
|
this.testingSieveErrorDesc('');
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
this.testingSmtpError.subscribe(function (bValue) {
|
this.testingSmtpError.subscribe(function (bValue) {
|
||||||
if (!bValue)
|
if (!bValue)
|
||||||
{
|
{
|
||||||
|
|
@ -54,9 +63,6 @@
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.testingImapErrorDesc = ko.observable('');
|
|
||||||
this.testingSmtpErrorDesc = ko.observable('');
|
|
||||||
|
|
||||||
this.imapServerFocus = ko.observable(false);
|
this.imapServerFocus = ko.observable(false);
|
||||||
this.sieveServerFocus = ko.observable(false);
|
this.sieveServerFocus = ko.observable(false);
|
||||||
this.smtpServerFocus = ko.observable(false);
|
this.smtpServerFocus = ko.observable(false);
|
||||||
|
|
@ -147,7 +153,6 @@
|
||||||
this.testConnectionCommand = Utils.createCommand(this, function () {
|
this.testConnectionCommand = Utils.createCommand(this, function () {
|
||||||
|
|
||||||
this.page('main');
|
this.page('main');
|
||||||
this.sieveSettings(false);
|
|
||||||
|
|
||||||
this.testingDone(false);
|
this.testingDone(false);
|
||||||
this.testingImapError(false);
|
this.testingImapError(false);
|
||||||
|
|
@ -277,12 +282,19 @@
|
||||||
this.testing(false);
|
this.testing(false);
|
||||||
if (Enums.StorageResultType.Success === sResult && oData.Result)
|
if (Enums.StorageResultType.Success === sResult && oData.Result)
|
||||||
{
|
{
|
||||||
|
var
|
||||||
|
bImap = false,
|
||||||
|
bSieve = false
|
||||||
|
;
|
||||||
|
|
||||||
this.testingDone(true);
|
this.testingDone(true);
|
||||||
this.testingImapError(true !== oData.Result.Imap);
|
this.testingImapError(true !== oData.Result.Imap);
|
||||||
this.testingSmtpError(true !== oData.Result.Smtp);
|
this.testingSmtpError(true !== oData.Result.Smtp);
|
||||||
|
this.testingSieveError(true !== oData.Result.Sieve);
|
||||||
|
|
||||||
if (this.testingImapError() && oData.Result.Imap)
|
if (this.testingImapError() && oData.Result.Imap)
|
||||||
{
|
{
|
||||||
|
bImap = true;
|
||||||
this.testingImapErrorDesc(oData.Result.Imap);
|
this.testingImapErrorDesc(oData.Result.Imap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -290,11 +302,28 @@
|
||||||
{
|
{
|
||||||
this.testingSmtpErrorDesc(oData.Result.Smtp);
|
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
|
else
|
||||||
{
|
{
|
||||||
this.testingImapError(true);
|
this.testingImapError(true);
|
||||||
this.testingSmtpError(true);
|
this.testingSmtpError(true);
|
||||||
|
this.testingSieveError(true);
|
||||||
|
this.sieveSettings(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -325,6 +354,7 @@
|
||||||
this.testingDone(false);
|
this.testingDone(false);
|
||||||
this.testingImapError(false);
|
this.testingImapError(false);
|
||||||
this.testingSmtpError(false);
|
this.testingSmtpError(false);
|
||||||
|
this.testingSieveError(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
DomainPopupView.prototype.onHide = function ()
|
DomainPopupView.prototype.onHide = function ()
|
||||||
|
|
|
||||||
|
|
@ -3150,9 +3150,12 @@ class Actions
|
||||||
$sImapErrorDesc = '';
|
$sImapErrorDesc = '';
|
||||||
$bSmtpResult = false;
|
$bSmtpResult = false;
|
||||||
$sSmtpErrorDesc = '';
|
$sSmtpErrorDesc = '';
|
||||||
|
$bSieveResult = false;
|
||||||
|
$sSieveErrorDesc = '';
|
||||||
|
|
||||||
$iImapTime = 0;
|
$iImapTime = 0;
|
||||||
$iSmtpTime = 0;
|
$iSmtpTime = 0;
|
||||||
|
$iSieveTime = 0;
|
||||||
|
|
||||||
$iConnectionTimeout = 5;
|
$iConnectionTimeout = 5;
|
||||||
|
|
||||||
|
|
@ -3230,11 +3233,42 @@ class Actions
|
||||||
$sSmtpErrorDesc = $oException->getMessage();
|
$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(
|
return $this->DefaultResponse(__FUNCTION__, array(
|
||||||
'Imap' => $bImapResult ? true : $sImapErrorDesc,
|
'Imap' => $bImapResult ? true : $sImapErrorDesc,
|
||||||
'Smtp' => $bSmtpResult ? true : $sSmtpErrorDesc
|
'Smtp' => $bSmtpResult ? true : $sSmtpErrorDesc,
|
||||||
|
'Sieve' => $bSieveResult ? true : $sSieveErrorDesc
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span5" data-bind="css: { 'testing-done': testingDone, 'testing-error': testingImapError }">
|
<div class="span5">
|
||||||
<div class="legend imap-header">
|
<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-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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div data-bind="visible: !sieveSettings()">
|
<div data-bind="visible: !sieveSettings()">
|
||||||
|
|
@ -144,8 +149,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="span5" data-bind="css: { 'testing-done': testingDone, 'testing-error': testingSmtpError }">
|
<div class="span5">
|
||||||
<div class="legend smtp-header">
|
<div class="legend smtp-header" data-bind="css: { 'testing-done': testingDone, 'testing-error': testingSmtpError }">
|
||||||
<span data-placement="bottom" data-bind="tooltipForTest: testingSmtpErrorDesc">
|
<span data-placement="bottom" data-bind="tooltipForTest: testingSmtpErrorDesc">
|
||||||
SMTP
|
SMTP
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue