This commit is contained in:
the-djmaze 2023-11-29 22:45:40 +01:00
parent d75f64904f
commit fb8d557099
9 changed files with 40 additions and 8 deletions

View file

@ -79,6 +79,7 @@ export class MessageModel extends AbstractModel {
subject: '', subject: '',
plain: '', plain: '',
html: '', html: '',
preview: null,
size: 0, size: 0,
spamScore: 0, spamScore: 0,
spamResult: '', spamResult: '',

View file

@ -37,6 +37,7 @@ const
imapDisable_thread: false, imapDisable_thread: false,
imapDisable_binary: false, imapDisable_binary: false,
imapDisable_status_size: true, imapDisable_status_size: true,
imapDisable_preview: true,
imapExpunge_all_on_delete: false, imapExpunge_all_on_delete: false,
imapFast_simple_search: true, imapFast_simple_search: true,
imapFetch_new_messages: true, imapFetch_new_messages: true,
@ -88,6 +89,7 @@ const
disable_thread: !!oDomain.imapDisable_thread(), disable_thread: !!oDomain.imapDisable_thread(),
disable_binary: !!oDomain.imapDisable_binary(), disable_binary: !!oDomain.imapDisable_binary(),
disable_status_size: !!oDomain.imapDisable_status_size(), disable_status_size: !!oDomain.imapDisable_status_size(),
disable_preview: !!oDomain.imapDisable_preview(),
folder_list_limit: pInt(oDomain.imapFolder_list_limit()), folder_list_limit: pInt(oDomain.imapFolder_list_limit()),
message_list_limit: pInt(oDomain.imapMessage_list_limit()) message_list_limit: pInt(oDomain.imapMessage_list_limit())
/* /*

View file

@ -29,6 +29,7 @@
"disable_thread": false, "disable_thread": false,
"disable_binary": false, "disable_binary": false,
"disable_status_size": true, "disable_status_size": true,
"disable_preview": true,
"use_expunge_all_on_delete": false, "use_expunge_all_on_delete": false,
"fast_simple_search": true, "fast_simple_search": true,
"force_select": false, "force_select": false,

View file

@ -330,6 +330,9 @@ class ImapClient extends \MailSo\Net\NetClient
if ($this->Settings->disable_status_size) { if ($this->Settings->disable_status_size) {
$aList = \array_diff($aList, ['STATUS=SIZE']); $aList = \array_diff($aList, ['STATUS=SIZE']);
} }
if ($this->Settings->disable_preview) {
$aList = \array_diff($aList, ['PREVIEW']);
}
} }
$this->aCapabilityItems = $aList; $this->aCapabilityItems = $aList;
} }

View file

@ -30,6 +30,8 @@ class Settings extends \MailSo\Net\ConnectSettings
$disable_binary = false, $disable_binary = false,
// STATUS SIZE can take a significant amount of time, therefore not active by default // STATUS SIZE can take a significant amount of time, therefore not active by default
$disable_status_size = true, $disable_status_size = true,
// RFC 8970
$disable_preview = true,
$expunge_all_on_delete = false, $expunge_all_on_delete = false,
$fast_simple_search = true, $fast_simple_search = true,
$fetch_new_messages = true, $fetch_new_messages = true,
@ -56,6 +58,7 @@ class Settings extends \MailSo\Net\ConnectSettings
'disable_thread', 'disable_thread',
'disable_binary', 'disable_binary',
'disable_status_size', 'disable_status_size',
'disable_preview',
'expunge_all_on_delete', 'expunge_all_on_delete',
'fast_simple_search', 'fast_simple_search',
'fetch_new_messages', 'fetch_new_messages',
@ -95,6 +98,7 @@ class Settings extends \MailSo\Net\ConnectSettings
'disable_thread' => $this->disable_thread, 'disable_thread' => $this->disable_thread,
'disable_binary' => $this->disable_binary, 'disable_binary' => $this->disable_binary,
'disable_status_size' => $this->disable_status_size, 'disable_status_size' => $this->disable_status_size,
'disable_preview' => $this->disable_preview,
'use_expunge_all_on_delete' => $this->expunge_all_on_delete, 'use_expunge_all_on_delete' => $this->expunge_all_on_delete,
// 'body_text_limit' => $this->body_text_limit, // 'body_text_limit' => $this->body_text_limit,
'fast_simple_search' => $this->fast_simple_search, 'fast_simple_search' => $this->fast_simple_search,

View file

@ -467,14 +467,18 @@ class MailClient
array &$aAllThreads = [], array &$aUnseenUIDs = []) : void array &$aAllThreads = [], array &$aUnseenUIDs = []) : void
{ {
if (\count($oRange)) { if (\count($oRange)) {
$aFetchIterator = $this->oImapClient->FetchIterate(array( $aFetchItems = array(
FetchType::UID, FetchType::UID,
FetchType::RFC822_SIZE, FetchType::RFC822_SIZE,
FetchType::INTERNALDATE, FetchType::INTERNALDATE,
FetchType::FLAGS, FetchType::FLAGS,
FetchType::BODYSTRUCTURE, FetchType::BODYSTRUCTURE
$this->getEnvelopeOrHeadersRequestString() );
), (string) $oRange, $oRange->UID); if ($this->oImapClient->hasCapability('PREVIEW')) {
$aFetchItems[] = FetchType::PREVIEW;
}
$aFetchItems[] = $this->getEnvelopeOrHeadersRequestString();
$aFetchIterator = $this->oImapClient->FetchIterate($aFetchItems, (string) $oRange, $oRange->UID);
// FETCH does not respond in the id order of the SequenceSet, so we prefill $aCollection for the right sort order. // FETCH does not respond in the id order of the SequenceSet, so we prefill $aCollection for the right sort order.
$aCollection = \array_fill_keys($oRange->getArrayCopy(), null); $aCollection = \array_fill_keys($oRange->getArrayCopy(), null);
foreach ($aFetchIterator as /* @var $oFetchResponseItem \MailSo\Imap\FetchResponse */ $oFetchResponseItem) { foreach ($aFetchIterator as /* @var $oFetchResponseItem \MailSo\Imap\FetchResponse */ $oFetchResponseItem) {

View file

@ -41,6 +41,10 @@ class Message implements \JsonSerializable
*/ */
$sEmailId = null, $sEmailId = null,
$sThreadId = null, $sThreadId = null,
/**
* https://www.rfc-editor.org/rfc/rfc8970
*/
$sPreview = null,
// https://autocrypt.org/level1.html#the-autocrypt-header // https://autocrypt.org/level1.html#the-autocrypt-header
$sAutocrypt = ''; $sAutocrypt = '';
@ -154,7 +158,7 @@ class Message implements \JsonSerializable
// $oMessage->sEmailId = $oMessage->sEmailId ?: $oFetchResponse->GetFetchValue('X-GUID'); // $oMessage->sEmailId = $oMessage->sEmailId ?: $oFetchResponse->GetFetchValue('X-GUID');
$aThreadId = $oFetchResponse->GetFetchValue(FetchType::THREADID); $aThreadId = $oFetchResponse->GetFetchValue(FetchType::THREADID);
$oMessage->sThreadId = $aThreadId ? $aThreadId[0] : $oFetchResponse->GetFetchValue('X-GM-THRID'); $oMessage->sThreadId = $aThreadId ? $aThreadId[0] : $oFetchResponse->GetFetchValue('X-GM-THRID');
$oMessage->sPreview = $oFetchResponse->GetFetchValue(FetchType::PREVIEW) ?: null;
$sCharset = $oBodyStructure ? Utils::NormalizeCharset($oBodyStructure->SearchCharset()) : ''; $sCharset = $oBodyStructure ? Utils::NormalizeCharset($oBodyStructure->SearchCharset()) : '';
$sHeaders = $oFetchResponse->GetHeaderFieldsValue(); $sHeaders = $oFetchResponse->GetHeaderFieldsValue();
@ -461,6 +465,10 @@ class Message implements \JsonSerializable
} }
} }
if (\str_starts_with($oMessage->sSubject, '[Preview]')) {
$oMessage->sSubject = \mb_substr($oMessage->sSubject, 10);
}
return $oMessage; return $oMessage;
} }
@ -566,7 +574,9 @@ class Message implements \JsonSerializable
// 'threadId' => $this->sThreadId, // 'threadId' => $this->sThreadId,
// 'mailboxIds' => ['mailboxid'=>true], // 'mailboxIds' => ['mailboxid'=>true],
// 'keywords' => $keywords, // 'keywords' => $keywords,
'size' => $this->iSize 'size' => $this->iSize,
'preview' => $this->sPreview
); );
if ($this->DraftInfo) { if ($this->DraftInfo) {

View file

@ -128,6 +128,13 @@
label: 'STATUS SIZE' label: 'STATUS SIZE'
} }
}"></div> }"></div>
<div data-bind="component: {
name: 'Checkbox',
params: {
value: imapDisable_preview,
label: 'PREVIEW'
}
}"></div>
<h4 data-i18n="POPUPS_DOMAIN/LIMITS"></h4> <h4 data-i18n="POPUPS_DOMAIN/LIMITS"></h4>
<div class="control-group"> <div class="control-group">

View file

@ -135,7 +135,7 @@
<div class="messageListItem" data-bind="css: lineAsCss()"> <div class="messageListItem" data-bind="css: lineAsCss()">
<div class="messageCheckbox"> <div class="messageCheckbox">
<div class="checkboxMessage fontastic" data-bind="text: checked() ? '☑' : '☐'"></div> <div class="checkboxMessage fontastic" data-bind="text: checked() ? '☑' : '☐'"></div>
</div><div> </div><div data-bind="attr: {'title':preview}">
<div class="flagParent fontastic"></div> <div class="flagParent fontastic"></div>
<div class="senderParent" data-bind="attr: {'title': senderClearEmailsString}, text: senderEmailsString"></div> <div class="senderParent" data-bind="attr: {'title': senderClearEmailsString}, text: senderEmailsString"></div>
<div class="subjectParent" data-bind="text: subject"></div> <div class="subjectParent" data-bind="text: subject"></div>
@ -155,7 +155,7 @@
<div class="messageListItem" data-bind="css: lineAsCss()"> <div class="messageListItem" data-bind="css: lineAsCss()">
<div class="messageCheckbox"> <div class="messageCheckbox">
<div class="checkboxMessage fontastic" data-bind="text: checked() ? '☑' : '☐'"></div> <div class="checkboxMessage fontastic" data-bind="text: checked() ? '☑' : '☐'"></div>
</div><div data-bind="attr:{style:indent()}, css:{reply:indent()}"> </div><div data-bind="attr:{style:indent(), 'title':preview}, css:{reply:indent()}">
<div class="flagParent fontastic"></div> <div class="flagParent fontastic"></div>
<div class="senderParent" data-bind="attr: {'title': senderClearEmailsString}, text: senderEmailsString"></div> <div class="senderParent" data-bind="attr: {'title': senderClearEmailsString}, text: senderEmailsString"></div>
<div class="subjectParent" data-bind="text: subject"></div> <div class="subjectParent" data-bind="text: subject"></div>