This commit is contained in:
the-djmaze 2023-06-26 12:41:47 +02:00
parent 841fca17cd
commit 47e3fc90f2
6 changed files with 46 additions and 14 deletions

View file

@ -35,6 +35,7 @@ const
imapDisable_move: false,
imapDisable_sort: false,
imapDisable_thread: false,
imapDisable_binary: false,
imapExpunge_all_on_delete: false,
imapFast_simple_search: true,
imapFetch_new_messages: true,
@ -84,6 +85,7 @@ const
disable_move: !!oDomain.imapDisable_move(),
disable_sort: !!oDomain.imapDisable_sort(),
disable_thread: !!oDomain.imapDisable_thread(),
disable_binary: !!oDomain.imapDisable_binary(),
folder_list_limit: pInt(oDomain.imapFolder_list_limit()),
message_list_limit: pInt(oDomain.imapMessage_list_limit())
/*

View file

@ -27,6 +27,7 @@
"disable_move": false,
"disable_sort": false,
"disable_thread": false,
"disable_binary": false,
"use_expunge_all_on_delete": false,
"fast_simple_search": true,
"force_select": false,

View file

@ -317,6 +317,9 @@ class ImapClient extends \MailSo\Net\NetClient
if ($this->Settings->disable_list_status) {
$aList = \array_diff($aList, ['LIST-STATUS']);
}
if ($this->Settings->disable_binary) {
$aList = \array_diff($aList, ['BINARY']);
}
if (8 > PHP_INT_SIZE) {
$aList = \array_diff($aList, ['CONDSTORE']);
}

View file

@ -27,6 +27,7 @@ class Settings extends \MailSo\Net\ConnectSettings
$disable_move = false,
$disable_sort = false,
$disable_thread = false,
$disable_binary = false,
$expunge_all_on_delete = false,
$fast_simple_search = true,
$fetch_new_messages = true,
@ -51,6 +52,7 @@ class Settings extends \MailSo\Net\ConnectSettings
'disable_move',
'disable_sort',
'disable_thread',
'disable_binary',
'expunge_all_on_delete',
'fast_simple_search',
'fetch_new_messages',
@ -88,6 +90,7 @@ class Settings extends \MailSo\Net\ConnectSettings
'disable_move' => $this->disable_move,
'disable_sort' => $this->disable_sort,
'disable_thread' => $this->disable_thread,
'disable_binary' => $this->disable_binary,
'use_expunge_all_on_delete' => $this->expunge_all_on_delete,
// 'body_text_limit' => $this->body_text_limit,
'fast_simple_search' => $this->fast_simple_search,

View file

@ -239,21 +239,37 @@ class MailClient
}
}
$aFetchResponse = $this->oImapClient->Fetch(array(
// FetchType::BINARY_SIZE.'['.$sMimeIndex.']',
// Push in the aFetchCallbacks array and then called by \MailSo\Imap\Traits\ResponseParser::partialResponseLiteralCallbackCallable
array(
$sPeek.'['.$sMimeIndex.']',
function ($sParent, $sLiteralAtomUpperCase, $rImapLiteralStream) use ($mCallback, $sMimeIndex, $sMailEncoding, $sContentType, $sFileName)
{
if (\strlen($sLiteralAtomUpperCase) && \is_resource($rImapLiteralStream) && 'FETCH' === $sParent) {
$mCallback($sMailEncoding
? \MailSo\Base\StreamWrappers\Binary::CreateStream($rImapLiteralStream, $sMailEncoding)
: $rImapLiteralStream,
$sContentType, $sFileName, $sMimeIndex);
}
$callback = function ($sParent, $sLiteralAtomUpperCase, $rImapLiteralStream)
use ($mCallback, $sMimeIndex, $sMailEncoding, $sContentType, $sFileName)
{
if (\strlen($sLiteralAtomUpperCase) && \is_resource($rImapLiteralStream) && 'FETCH' === $sParent) {
$mCallback($sMailEncoding
? \MailSo\Base\StreamWrappers\Binary::CreateStream($rImapLiteralStream, $sMailEncoding)
: $rImapLiteralStream,
$sContentType, $sFileName, $sMimeIndex);
}
)), $iIndex, true);
};
try {
$aFetchResponse = $this->oImapClient->Fetch(array(
// FetchType::BINARY_SIZE.'['.$sMimeIndex.']',
// Push in the aFetchCallbacks array and then called by \MailSo\Imap\Traits\ResponseParser::partialResponseLiteralCallbackCallable
array(
$sPeek.'['.$sMimeIndex.']',
$callback
)), $iIndex, true);
} catch (\MailSo\Imap\Exceptions\NegativeResponseException $oException) {
if (FetchType::BINARY_PEEK === $sPeek && \preg_match('/UNKNOWN-CTE|PARSE/', $oException->getMessage())) {
$this->logException($oException, \LOG_WARNING);
$aFetchResponse = $this->oImapClient->Fetch(array(
array(
FetchType::BODY_PEEK . '[' . $sMimeIndex . ']',
$callback
)), $iIndex, true);
} else {
throw $e;
}
}
return ($aFetchResponse && 1 === \count($aFetchResponse));
}

View file

@ -114,6 +114,13 @@
label: 'THREAD'
}
}"></div>
<div data-bind="component: {
name: 'Checkbox',
params: {
value: imapDisable_binary,
label: 'BINARY'
}
}"></div>
<h4 data-i18n="POPUPS_DOMAIN/LIMITS"></h4>
<div class="control-group">