Move application.ini imap settings from [labs] section to own [imap] section

This commit is contained in:
the-djmaze 2022-10-17 16:54:17 +02:00
parent 69fb887e63
commit 9d9ea1ec31
8 changed files with 74 additions and 59 deletions

View file

@ -226,6 +226,25 @@ http_expires = 3600
; Caching message UIDs when searching and sorting (threading)
server_uids = On
[imap]
use_sort = On
use_force_selection = Off
use_thread = On
use_move = Off
use_expunge_all_on_delete = Off
body_text_limit = 555000
message_list_fast_simple_search = On
message_list_count_limit_trigger = 0
message_list_date_filter = 0
message_list_permanent_filter = ""
message_all_headers = Off
large_thread_limit = 50
folder_list_limit = 200
show_login_alert = On
use_list_status = On
timeout = 300
disable_metadata = Off
[labs]
cache_system_data = On
date_from_headers = On
@ -238,23 +257,6 @@ allow_ctrl_enter_on_compose = On
try_to_detect_hidden_images = Off
use_app_debug_js = Off
use_app_debug_css = Off
use_imap_sort = On
use_imap_force_selection = Off
use_imap_thread = On
use_imap_move = Off
use_imap_expunge_all_on_delete = Off
imap_body_text_limit = 555000
imap_message_list_fast_simple_search = On
imap_message_list_count_limit_trigger = 0
imap_message_list_date_filter = 0
imap_message_list_permanent_filter = ""
imap_message_all_headers = Off
imap_large_thread_limit = 50
imap_folder_list_limit = 200
imap_show_login_alert = On
imap_use_list_status = On
imap_timeout = 300
imap_disable_metadata = Off
smtp_show_server_errors = Off
smtp_timeout = 60
sieve_auth_plain_initial = On

View file

@ -724,10 +724,10 @@ class Actions
$aResult['System'], array(
'allowHtmlEditorBitiButtons' => (bool)$oConfig->Get('labs', 'allow_html_editor_biti_buttons', false),
'allowCtrlEnterOnCompose' => (bool)$oConfig->Get('labs', 'allow_ctrl_enter_on_compose', false),
'useImapThread' => (bool)$oConfig->Get('labs', 'use_imap_thread', false),
'useImapThread' => (bool)$oConfig->Get('imap', 'use_thread', false),
'allowAppendMessage' => (bool)$oConfig->Get('labs', 'allow_message_append', false),
'folderSpecLimit' => (int)$oConfig->Get('labs', 'folders_spec_limit', 50),
'listPermanentFiltered' => '' !== \trim($oConfig->Get('labs', 'imap_message_list_permanent_filter', '')),
'listPermanentFiltered' => '' !== \trim($oConfig->Get('imap', 'message_list_permanent_filter', '')),
'attachmentsActions' => $aAttachmentsActions,
'customLogoutLink' => $oConfig->Get('labs', 'custom_logout_link', ''),
)

View file

@ -14,8 +14,8 @@ trait Folders
{
return $this->MailClient()->Folders('', '*',
$HideUnsubscribed,
(int) $this->Config()->Get('labs', 'imap_folder_list_limit', 200),
(bool) $this->Config()->Get('labs', 'imap_use_list_status', true)
(int) $this->Config()->Get('imap', 'folder_list_limit', 200),
(bool) $this->Config()->Get('imap', 'use_list_status', true)
);
}
@ -71,7 +71,7 @@ trait Folders
$aSystemFolders = array();
$this->recFoldersTypes($oAccount, $oFolderCollection, $aSystemFolders);
if (!$this->Config()->Get('labs', 'use_imap_sort', true)) {
if (!$this->Config()->Get('imap', 'use_sort', true)) {
$oFolderCollection->capabilities = \array_filter($oFolderCollection->capabilities, function($item){
return !\preg_match('/^E?SORT/', $item);
});
@ -189,7 +189,7 @@ trait Folders
$aCapabilities = \array_filter($this->MailClient()->Capabilities(), function($item){
return !\preg_match('/^(IMAP|AUTH|LOGIN|SASL)/', $item);
});
if (!$this->Config()->Get('labs', 'imap_use_list_status', true)) {
if (!$this->Config()->Get('imap', 'use_list_status', true)) {
$key = \array_search('LIST-STATUS', $aCapabilities);
if (false !== $key) {
unset($aCapabilities[$key]);

View file

@ -65,12 +65,12 @@ trait Messages
try
{
if (!$this->Config()->Get('labs', 'use_imap_thread', false)) {
if (!$this->Config()->Get('imap', 'use_thread', false)) {
$oParams->bUseThreads = false;
}
$oParams->oCacher = $this->cacherForUids();
$oParams->bUseSortIfSupported = !!$this->Config()->Get('labs', 'use_imap_sort', true);
$oParams->bUseSortIfSupported = !!$this->Config()->Get('imap', 'use_sort', true);
$oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount);
if ($oSettingsLocal instanceof \RainLoop\Settings) {
@ -451,7 +451,7 @@ trait Messages
{
$oMessage = $this->MailClient()->Message($sFolder, $iUid, true,
$this->cacherForThreads(),
(int) $this->Config()->Get('labs', 'imap_body_text_limit', 0)
(int) $this->Config()->Get('imap', 'body_text_limit', 0)
);
}
catch (\Throwable $oException)
@ -482,7 +482,7 @@ trait Messages
try
{
$this->MailClient()->MessageDelete($sFolder, new SequenceSet($aUids),
!!$this->Config()->Get('labs', 'use_imap_expunge_all_on_delete', false));
!!$this->Config()->Get('imap', 'use_expunge_all_on_delete', false));
}
catch (\Throwable $oException)
{
@ -548,8 +548,8 @@ trait Messages
try
{
$this->MailClient()->MessageMove($sFromFolder, $sToFolder, $oUids,
!!$this->Config()->Get('labs', 'use_imap_move', true),
!!$this->Config()->Get('labs', 'use_imap_expunge_all_on_delete', false)
!!$this->Config()->Get('imap', 'use_move', true),
!!$this->Config()->Get('imap', 'use_expunge_all_on_delete', false)
);
}
catch (\Throwable $oException)
@ -959,7 +959,7 @@ trait Messages
private function cacherForThreads()
{
$oAccount = $this->getAccountFromToken(false);
return !!$this->Config()->Get('labs', 'use_imap_thread', false) ? $this->Cacher($oAccount) : null;
return !!$this->Config()->Get('imap', 'use_thread', false) ? $this->Cacher($oAccount) : null;
}
private function buildReadReceiptMessage(Account $oAccount) : \MailSo\Mime\Message

View file

@ -444,7 +444,7 @@ trait UserAuth
$this->LoggerAuthHelper($oAccount);
}
if ($this->Config()->Get('labs', 'imap_show_login_alert', true)) {
if ($this->Config()->Get('imap', 'show_login_alert', true)) {
throw new ClientException(Notifications::AuthError, $oException, $oException->getAlertFromStatus());
} else {
throw new ClientException(Notifications::AuthError, $oException);

View file

@ -68,25 +68,25 @@ abstract class Api
if (\class_exists('MailSo\Config'))
{
\MailSo\Config::$MessageListFastSimpleSearch =
!!static::Config()->Get('labs', 'imap_message_list_fast_simple_search', true);
!!static::Config()->Get('imap', 'message_list_fast_simple_search', true);
\MailSo\Config::$MessageListCountLimitTrigger =
(int) static::Config()->Get('labs', 'imap_message_list_count_limit_trigger', 0);
(int) static::Config()->Get('imap', 'message_list_count_limit_trigger', 0);
\MailSo\Config::$MessageListDateFilter =
(int) static::Config()->Get('labs', 'imap_message_list_date_filter', 0);
(int) static::Config()->Get('imap', 'message_list_date_filter', 0);
\MailSo\Config::$MessageListPermanentFilter =
\trim(static::Config()->Get('labs', 'imap_message_list_permanent_filter', ''));
\trim(static::Config()->Get('imap', 'message_list_permanent_filter', ''));
\MailSo\Config::$MessageAllHeaders =
!!static::Config()->Get('labs', 'imap_message_all_headers', false);
!!static::Config()->Get('imap', 'message_all_headers', false);
\MailSo\Config::$LargeThreadLimit =
(int) static::Config()->Get('labs', 'imap_large_thread_limit', 50);
(int) static::Config()->Get('imap', 'large_thread_limit', 50);
\MailSo\Config::$ImapTimeout =
(int) static::Config()->Get('labs', 'imap_timeout', 300);
(int) static::Config()->Get('imap', 'timeout', 300);
\MailSo\Config::$BoundaryPrefix =
\trim(static::Config()->Get('labs', 'boundary_prefix', ''));

View file

@ -81,6 +81,16 @@ class Application extends \RainLoop\Config\AbstractConfig
return $mResult;
}
public function Set(string $sSectionKey, string $sParamKey, $mParamValue) : void
{
if ('labs' === $sSectionKey && \str_contains($sParamKey, 'imap_')) {
// This is a workaround for the changed application structure
$sSectionKey = 'imap';
$sParamKey = \str_replace('imap_', '', $sParamKey);
}
parent::Set($sSectionKey, $sParamKey, $mParamValue);
}
public function SetPassword(string $sPassword) : void
{
$this->Set('security', 'admin_password', \password_hash($sPassword, PASSWORD_DEFAULT));
@ -180,8 +190,8 @@ class Application extends \RainLoop\Config\AbstractConfig
'admin_panel_host' => array(''),
'admin_panel_key' => array('admin'),
'content_security_policy' => array(''),
'csp_report' => array(false),
'encrypt_cipher' => array($sCipher),
'csp_report' => array(false, 'Report CSP errors to PHP and/or SnappyMail Log'),
'encrypt_cipher' => array($sCipher, 'A valid cipher method from https://php.net/openssl_get_cipher_methods'),
'cookie_samesite' => array('Strict', 'Strict, Lax or None')
),
@ -328,6 +338,26 @@ Enables caching in the system'),
'server_uids' => array(true, 'Caching message UIDs when searching and sorting (threading)')
),
'imap' => array(
'use_sort' => array(true),
'use_force_selection' => array(false),
'use_thread' => array(true),
'use_move' => array(false),
'use_expunge_all_on_delete' => array(false),
'body_text_limit' => array(555000),
'message_list_fast_simple_search' => array(true),
'message_list_count_limit_trigger' => array(0),
'message_list_date_filter' => array(0),
'message_list_permanent_filter' => array(''),
'message_all_headers' => array(false),
'large_thread_limit' => array(50),
'folder_list_limit' => array(200),
'show_login_alert' => array(true),
'use_list_status' => array(true),
'timeout' => array(300),
'disable_metadata' => array(false),
),
'labs' => array(
'cache_system_data' => array(true),
'date_from_headers' => array(true),
@ -340,23 +370,6 @@ Enables caching in the system'),
'try_to_detect_hidden_images' => array(false),
'use_app_debug_js' => array(false),
'use_app_debug_css' => array(false),
'use_imap_sort' => array(true),
'use_imap_force_selection' => array(false),
'use_imap_thread' => array(true),
'use_imap_move' => array(false),
'use_imap_expunge_all_on_delete' => array(false),
'imap_body_text_limit' => array(555000),
'imap_message_list_fast_simple_search' => array(true),
'imap_message_list_count_limit_trigger' => array(0),
'imap_message_list_date_filter' => array(0),
'imap_message_list_permanent_filter' => array(''),
'imap_message_all_headers' => array(false),
'imap_large_thread_limit' => array(50),
'imap_folder_list_limit' => array(200),
'imap_show_login_alert' => array(true),
'imap_use_list_status' => array(true),
'imap_timeout' => array(300),
'imap_disable_metadata' => array(false),
'smtp_show_server_errors' => array(false),
'smtp_timeout' => array(60),
'sieve_auth_plain_initial' => array(true),

View file

@ -198,8 +198,8 @@ abstract class Account implements \JsonSerializable
public function ImapConnectAndLoginHelper(\RainLoop\Plugins\Manager $oPlugins, \MailSo\Mail\MailClient $oMailClient, \RainLoop\Config\Application $oConfig) : bool
{
$oImapClient = $oMailClient->ImapClient();
$oImapClient->__FORCE_SELECT_ON_EXAMINE__ = !!$oConfig->Get('labs', 'use_imap_force_selection');
$oImapClient->__DISABLE_METADATA = !!$oConfig->Get('labs', 'imap_disable_metadata');
$oImapClient->__FORCE_SELECT_ON_EXAMINE__ = !!$oConfig->Get('imap', 'use_force_selection');
$oImapClient->__DISABLE_METADATA = !!$oConfig->Get('imap', 'disable_metadata');
$aCredentials = \array_merge(
$this->Domain()->ImapSettings(),