mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Offload server CPU to client when fetching folder list
This commit is contained in:
parent
32712415ef
commit
c8e4d589cb
8 changed files with 59 additions and 197 deletions
|
|
@ -73,15 +73,11 @@ export const SetSystemFoldersNotification = {
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
export const ClientSideKeyName = {
|
export const ClientSideKeyName = {
|
||||||
FoldersLashHash: 0,
|
|
||||||
MessagesInboxLastHash: 1,
|
|
||||||
MailBoxListSize: 2,
|
|
||||||
ExpandedFolders: 3,
|
ExpandedFolders: 3,
|
||||||
FolderListSize: 4,
|
FolderListSize: 4,
|
||||||
MessageListSize: 5,
|
MessageListSize: 5,
|
||||||
LastReplyAction: 6,
|
LastReplyAction: 6,
|
||||||
LastSignMe: 7,
|
LastSignMe: 7,
|
||||||
ComposeLastIdentityID: 8,
|
|
||||||
MessageHeaderFullInfo: 9,
|
MessageHeaderFullInfo: 9,
|
||||||
MessageAttachmentControls: 10
|
MessageAttachmentControls: 10
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { AbstractCollectionModel } from 'Model/AbstractCollection';
|
||||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||||
import { isArray, getKeyByValue, forEachObjectEntry, b64EncodeJSONSafe } from 'Common/Utils';
|
import { isArray, getKeyByValue, forEachObjectEntry, b64EncodeJSONSafe } from 'Common/Utils';
|
||||||
import { ClientSideKeyName, FolderType, FolderMetadataKeys } from 'Common/EnumsUser';
|
import { ClientSideKeyName, FolderType, FolderMetadataKeys } from 'Common/EnumsUser';
|
||||||
import * as Cache from 'Common/Cache';
|
import { getFolderFromCacheList, setFolder, setFolderInboxName, setFolderHash } from 'Common/Cache';
|
||||||
import { Settings, SettingsGet } from 'Common/Globals';
|
import { Settings, SettingsGet } from 'Common/Globals';
|
||||||
|
|
||||||
import * as Local from 'Storage/Client';
|
import * as Local from 'Storage/Client';
|
||||||
|
|
@ -25,7 +25,7 @@ import { AbstractModel } from 'Knoin/AbstractModel';
|
||||||
const
|
const
|
||||||
normalizeFolder = sFolderFullName => ('' === sFolderFullName
|
normalizeFolder = sFolderFullName => ('' === sFolderFullName
|
||||||
|| UNUSED_OPTION_VALUE === sFolderFullName
|
|| UNUSED_OPTION_VALUE === sFolderFullName
|
||||||
|| null !== Cache.getFolderFromCacheList(sFolderFullName))
|
|| null !== getFolderFromCacheList(sFolderFullName))
|
||||||
? sFolderFullName
|
? sFolderFullName
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
|
|
@ -44,7 +44,6 @@ export class FolderCollectionModel extends AbstractCollectionModel
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.CountRec
|
this.CountRec
|
||||||
this.FoldersHash
|
|
||||||
this.IsThreadsSupported
|
this.IsThreadsSupported
|
||||||
this.Namespace;
|
this.Namespace;
|
||||||
this.Optimized
|
this.Optimized
|
||||||
|
|
@ -65,23 +64,20 @@ export class FolderCollectionModel extends AbstractCollectionModel
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.reviveFromJson(object, oFolder => {
|
const result = super.reviveFromJson(object, oFolder => {
|
||||||
let oCacheFolder = Cache.getFolderFromCacheList(oFolder.FullName),
|
let oCacheFolder = getFolderFromCacheList(oFolder.FullName),
|
||||||
type = FolderType[getKeyByValue(SystemFolders, oFolder.FullName)];
|
type = FolderType[getKeyByValue(SystemFolders, oFolder.FullName)];
|
||||||
|
|
||||||
if (oCacheFolder) {
|
if (!oCacheFolder) {
|
||||||
oFolder.SubFolders = FolderCollectionModel.reviveFromJson(oFolder.SubFolders);
|
|
||||||
oFolder.SubFolders && oCacheFolder.subFolders(oFolder.SubFolders);
|
|
||||||
} else {
|
|
||||||
oCacheFolder = FolderModel.reviveFromJson(oFolder);
|
oCacheFolder = FolderModel.reviveFromJson(oFolder);
|
||||||
if (!oCacheFolder)
|
if (!oCacheFolder)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (1 == type) {
|
if (1 == type) {
|
||||||
oCacheFolder.type(FolderType.Inbox);
|
oCacheFolder.type(FolderType.Inbox);
|
||||||
Cache.setFolderInboxName(oFolder.FullName);
|
setFolderInboxName(oFolder.FullName);
|
||||||
}
|
}
|
||||||
Cache.setFolder(oCacheFolder);
|
setFolder(oCacheFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 < type) {
|
if (1 < type) {
|
||||||
|
|
@ -94,7 +90,7 @@ export class FolderCollectionModel extends AbstractCollectionModel
|
||||||
|
|
||||||
if (oFolder.Extended) {
|
if (oFolder.Extended) {
|
||||||
if (oFolder.Extended.Hash) {
|
if (oFolder.Extended.Hash) {
|
||||||
Cache.setFolderHash(oCacheFolder.fullName, oFolder.Extended.Hash);
|
setFolderHash(oCacheFolder.fullName, oFolder.Extended.Hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null != oFolder.Extended.MessageCount) {
|
if (null != oFolder.Extended.MessageCount) {
|
||||||
|
|
@ -107,6 +103,31 @@ export class FolderCollectionModel extends AbstractCollectionModel
|
||||||
}
|
}
|
||||||
return oCacheFolder;
|
return oCacheFolder;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let i = result.length;
|
||||||
|
if (i) {
|
||||||
|
try {
|
||||||
|
let collator = new Intl.Collator(undefined, {numeric: true, sensitivity: 'base'});
|
||||||
|
result.sort((a, b) =>
|
||||||
|
a.isInbox() ? -1 : (b.isInbox() ? 1 : collator.compare(a.fullName, b.fullName))
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
while (i--) {
|
||||||
|
let folder = result[i], parent = getFolderFromCacheList(folder.parentName);
|
||||||
|
if (parent) {
|
||||||
|
parent.subFolders.unshift(folder);
|
||||||
|
result.splice(i,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
storeIt() {
|
storeIt() {
|
||||||
|
|
@ -141,8 +162,6 @@ export class FolderCollectionModel extends AbstractCollectionModel
|
||||||
FolderUserStore.archiveFolder(normalizeFolder(SystemFolders.Archive));
|
FolderUserStore.archiveFolder(normalizeFolder(SystemFolders.Archive));
|
||||||
|
|
||||||
// FolderUserStore.folderList.valueHasMutated();
|
// FolderUserStore.folderList.valueHasMutated();
|
||||||
|
|
||||||
Local.set(ClientSideKeyName.FoldersLashHash, this.FoldersHash);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { Notification } from 'Common/Enums';
|
import { Notification } from 'Common/Enums';
|
||||||
import { ClientSideKeyName, FolderMetadataKeys } from 'Common/EnumsUser';
|
import { FolderMetadataKeys } from 'Common/EnumsUser';
|
||||||
import { Settings } from 'Common/Globals';
|
import { Settings } from 'Common/Globals';
|
||||||
import { getNotification } from 'Common/Translator';
|
import { getNotification } from 'Common/Translator';
|
||||||
|
|
||||||
|
|
@ -10,8 +10,6 @@ import { Capa } from 'Common/Enums';
|
||||||
import { defaultOptionsAfterRender } from 'Common/Utils';
|
import { defaultOptionsAfterRender } from 'Common/Utils';
|
||||||
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
|
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
|
||||||
|
|
||||||
import * as Local from 'Storage/Client';
|
|
||||||
|
|
||||||
import { FolderUserStore } from 'Stores/User/Folder';
|
import { FolderUserStore } from 'Stores/User/Folder';
|
||||||
import { SettingsUserStore } from 'Stores/User/Settings';
|
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||||
|
|
||||||
|
|
@ -70,7 +68,6 @@ export class FoldersUserSettings /*extends AbstractViewSettings*/ {
|
||||||
const nameToEdit = folder ? folder.nameForEdit().trim() : '';
|
const nameToEdit = folder ? folder.nameForEdit().trim() : '';
|
||||||
|
|
||||||
if (nameToEdit && folder.name() !== nameToEdit) {
|
if (nameToEdit && folder.name() !== nameToEdit) {
|
||||||
Local.set(ClientSideKeyName.FoldersLashHash, '');
|
|
||||||
Remote.abort('Folders').post('FolderRename', FolderUserStore.foldersRenaming, {
|
Remote.abort('Folders').post('FolderRename', FolderUserStore.foldersRenaming, {
|
||||||
Folder: folder.fullName,
|
Folder: folder.fullName,
|
||||||
NewFolderName: nameToEdit
|
NewFolderName: nameToEdit
|
||||||
|
|
@ -136,8 +133,6 @@ export class FoldersUserSettings /*extends AbstractViewSettings*/ {
|
||||||
folderForDeletion(null);
|
folderForDeletion(null);
|
||||||
|
|
||||||
if (folderToRemove) {
|
if (folderToRemove) {
|
||||||
Local.set(ClientSideKeyName.FoldersLashHash, '');
|
|
||||||
|
|
||||||
Remote.abort('Folders').post('FolderDelete', FolderUserStore.foldersDeleting, {
|
Remote.abort('Folders').post('FolderDelete', FolderUserStore.foldersDeleting, {
|
||||||
Folder: folderToRemove.fullName
|
Folder: folderToRemove.fullName
|
||||||
}).then(
|
}).then(
|
||||||
|
|
@ -174,7 +169,6 @@ export class FoldersUserSettings /*extends AbstractViewSettings*/ {
|
||||||
|
|
||||||
toggleFolderSubscription(folder) {
|
toggleFolderSubscription(folder) {
|
||||||
let subscribe = !folder.subscribed();
|
let subscribe = !folder.subscribed();
|
||||||
Local.set(ClientSideKeyName.FoldersLashHash, '');
|
|
||||||
Remote.request('FolderSubscribe', null, {
|
Remote.request('FolderSubscribe', null, {
|
||||||
Folder: folder.fullName,
|
Folder: folder.fullName,
|
||||||
Subscribe: subscribe ? 1 : 0
|
Subscribe: subscribe ? 1 : 0
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,6 @@ class Folder implements \JsonSerializable
|
||||||
*/
|
*/
|
||||||
private $oImapFolder;
|
private $oImapFolder;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \MailSo\Mail\FolderCollection
|
|
||||||
*/
|
|
||||||
private $oSubFolders = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
|
|
@ -85,33 +80,6 @@ class Folder implements \JsonSerializable
|
||||||
return $this->oImapFolder->FlagsLowerCase();
|
return $this->oImapFolder->FlagsLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SubFolders(bool $bCreateIfNull = false) : ?\MailSo\Mail\FolderCollection
|
|
||||||
{
|
|
||||||
if ($bCreateIfNull && !$this->oSubFolders)
|
|
||||||
{
|
|
||||||
$this->oSubFolders = new FolderCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->oSubFolders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function HasSubFolders() : bool
|
|
||||||
{
|
|
||||||
return $this->oSubFolders && 0 < $this->oSubFolders->Count();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function HasVisibleSubFolders() : bool
|
|
||||||
{
|
|
||||||
if ($this->oSubFolders) {
|
|
||||||
foreach ($this->oSubFolders as $oFolder) {
|
|
||||||
if ($oFolder->IsSubscribed()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function IsSubscribed() : bool
|
public function IsSubscribed() : bool
|
||||||
{
|
{
|
||||||
return $this->bSubscribed;
|
return $this->bSubscribed;
|
||||||
|
|
@ -254,7 +222,6 @@ class Folder implements \JsonSerializable
|
||||||
'Name' => $this->Name(),
|
'Name' => $this->Name(),
|
||||||
'FullName' => $this->FullName(),
|
'FullName' => $this->FullName(),
|
||||||
'Delimiter' => (string) $this->Delimiter(),
|
'Delimiter' => (string) $this->Delimiter(),
|
||||||
// 'HasVisibleSubFolders' => $this->HasVisibleSubFolders(),
|
|
||||||
'Subscribed' => $this->bSubscribed,
|
'Subscribed' => $this->bSubscribed,
|
||||||
'Exists' => $this->bExists,
|
'Exists' => $this->bExists,
|
||||||
'Selectable' => $this->IsSelectable(),
|
'Selectable' => $this->IsSelectable(),
|
||||||
|
|
|
||||||
|
|
@ -30,48 +30,9 @@ class FolderCollection extends \MailSo\Base\Collection
|
||||||
parent::append($oFolder, $bToTop);
|
parent::append($oFolder, $bToTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetByFullName(string $sFullName) : ?Folder
|
|
||||||
{
|
|
||||||
foreach ($this as $oFolder) {
|
|
||||||
if ($oFolder->FullName() === $sFullName) {
|
|
||||||
return $oFolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($oFolder->HasSubFolders()) {
|
|
||||||
$mResult = $oFolder->SubFolders(true)->GetByFullName($sFullName);
|
|
||||||
if ($mResult) {
|
|
||||||
return $mResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function FindDelimiter() : string
|
public function FindDelimiter() : string
|
||||||
{
|
{
|
||||||
$sDelimiter = '/';
|
$oFolder = $this['INBOX'] ?? $this[0] ?? null;
|
||||||
|
|
||||||
$oFolder = $this->GetByFullName('INBOX');
|
|
||||||
if (!$oFolder && isset($this[0]))
|
|
||||||
{
|
|
||||||
$oFolder = $this[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $oFolder ? $oFolder->Delimiter() : '/';
|
return $oFolder ? $oFolder->Delimiter() : '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function AddWithPositionSearch(Folder $oMailFolder) : void
|
|
||||||
{
|
|
||||||
foreach ($this as $oItemFolder)
|
|
||||||
{
|
|
||||||
if (\str_starts_with($oMailFolder->FullName(), $oItemFolder->FullName().$oItemFolder->Delimiter()))
|
|
||||||
{
|
|
||||||
$oItemFolder->SubFolders(true)->AddWithPositionSearch($oMailFolder);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->append($oMailFolder);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1233,75 +1233,40 @@ class MailClient
|
||||||
$oFolderCollection->Optimized = 10 < $iOptimizationLimit && \count($aFolders) > $iOptimizationLimit;
|
$oFolderCollection->Optimized = 10 < $iOptimizationLimit && \count($aFolders) > $iOptimizationLimit;
|
||||||
|
|
||||||
$sINBOX = 'INBOX';
|
$sINBOX = 'INBOX';
|
||||||
$aSortedByLenImapFolders = array();
|
foreach ($aFolders as $sFullName => /* @var $oImapFolder \MailSo\Imap\Folder */ $oImapFolder) {
|
||||||
foreach ($aFolders as /* @var $oImapFolder \MailSo\Imap\Folder */ $oImapFolder)
|
|
||||||
{
|
|
||||||
$oMailFolder = new Folder($oImapFolder,
|
$oMailFolder = new Folder($oImapFolder,
|
||||||
($bUseListSubscribeStatus && (null === $aImapSubscribedFoldersHelper || \in_array($oImapFolder->FullName(), $aImapSubscribedFoldersHelper)))
|
($bUseListSubscribeStatus && (null === $aImapSubscribedFoldersHelper || \in_array($sFullName, $aImapSubscribedFoldersHelper)))
|
||||||
|| $oImapFolder->IsInbox()
|
|| $oImapFolder->IsInbox()
|
||||||
);
|
);
|
||||||
if ($oImapFolder->IsInbox()) {
|
if ($oImapFolder->IsInbox()) {
|
||||||
$sINBOX = $oMailFolder->FullName();
|
$sINBOX = $sFullName;
|
||||||
}
|
}
|
||||||
$aSortedByLenImapFolders[$oMailFolder->FullName()] = $oMailFolder;
|
$aFolders[$sFullName] = $oMailFolder;
|
||||||
}
|
|
||||||
|
|
||||||
// Add NonExistent folders
|
// Add NonExistent folders
|
||||||
$aAddedFolders = array();
|
|
||||||
foreach ($aSortedByLenImapFolders as /* @var $oMailFolder Folder */ $oMailFolder)
|
|
||||||
{
|
|
||||||
$sDelimiter = $oMailFolder->Delimiter();
|
$sDelimiter = $oMailFolder->Delimiter();
|
||||||
$aFolderExplode = \explode($sDelimiter, $oMailFolder->FullName());
|
$aFolderExplode = \explode($sDelimiter, $sFullName);
|
||||||
|
\array_pop($aFolderExplode);
|
||||||
if (1 < \count($aFolderExplode))
|
while ($aFolderExplode) {
|
||||||
{
|
$sNonExistentFolderFullName = \implode($sDelimiter, $aFolderExplode);
|
||||||
\array_pop($aFolderExplode);
|
if (!isset($aFolders[$sNonExistentFolderFullName])) {
|
||||||
|
try
|
||||||
$sNonExistentFolderFullName = '';
|
|
||||||
foreach ($aFolderExplode as $sFolderExplodeItem)
|
|
||||||
{
|
|
||||||
$sNonExistentFolderFullName .= \strlen($sNonExistentFolderFullName)
|
|
||||||
? $sDelimiter.$sFolderExplodeItem : $sFolderExplodeItem;
|
|
||||||
|
|
||||||
if (!isset($aSortedByLenImapFolders[$sNonExistentFolderFullName]))
|
|
||||||
{
|
{
|
||||||
try
|
$aFolders[$sNonExistentFolderFullName] =
|
||||||
{
|
Folder::NewNonExistentInstance($sNonExistentFolderFullName, $sDelimiter);
|
||||||
$aAddedFolders[$sNonExistentFolderFullName] =
|
}
|
||||||
Folder::NewNonExistentInstance($sNonExistentFolderFullName, $sDelimiter);
|
catch (\Throwable $oExc)
|
||||||
}
|
{
|
||||||
catch (\Throwable $oExc)
|
unset($oExc);
|
||||||
{
|
|
||||||
unset($oExc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
\array_pop($aFolderExplode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$aSortedByLenImapFolders = \array_merge($aSortedByLenImapFolders, $aAddedFolders);
|
$oFolderCollection->exchangeArray(\array_values($aFolders));
|
||||||
unset($aAddedFolders);
|
|
||||||
|
|
||||||
// Make sure the inbox is the first in list when sorted
|
$oFolderCollection->TotalCount = \count($aFolders);
|
||||||
if (isset($aSortedByLenImapFolders[$sINBOX])) {
|
|
||||||
$aSortedByLenImapFolders["\x00".$sINBOX] = $aSortedByLenImapFolders[$sINBOX];
|
|
||||||
unset($aSortedByLenImapFolders[$sINBOX]);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
// TODO: use active language
|
|
||||||
$collator = new \Collator('en_US');
|
|
||||||
\uksort($aSortedByLenImapFolders, static fn($a, $b) => $collator->compare($a, $b));
|
|
||||||
*/
|
|
||||||
\uksort($aSortedByLenImapFolders, 'strnatcasecmp');
|
|
||||||
|
|
||||||
foreach ($aSortedByLenImapFolders as $oMailFolder)
|
|
||||||
{
|
|
||||||
$oFolderCollection->AddWithPositionSearch($oMailFolder);
|
|
||||||
}
|
|
||||||
|
|
||||||
$oFolderCollection->TotalCount = \count($aSortedByLenImapFolders);
|
|
||||||
|
|
||||||
unset($aSortedByLenImapFolders);
|
|
||||||
|
|
||||||
return $oFolderCollection;
|
return $oFolderCollection;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ trait Folders
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->Config()->Get('labs', 'autocreate_system_folders', true))
|
if ($this->Config()->Get('labs', 'autocreate_system_folders', false))
|
||||||
{
|
{
|
||||||
$bDoItAgain = false;
|
$bDoItAgain = false;
|
||||||
|
|
||||||
|
|
@ -110,16 +110,17 @@ trait Folders
|
||||||
}
|
}
|
||||||
|
|
||||||
$sFullNameToCheck = $mFolderNameToCreate;
|
$sFullNameToCheck = $mFolderNameToCreate;
|
||||||
if (\strlen(\trim($sParent)))
|
if (\strlen($sParent))
|
||||||
{
|
{
|
||||||
$sFullNameToCheck = $sParent.$sDelimiter.$sFullNameToCheck;
|
$sFullNameToCheck = $sParent.$sDelimiter.$sFullNameToCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$oFolderCollection->GetByFullName($sFullNameToCheck))
|
if (!isset($oFolderCollection[$sFullNameToCheck]))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->MailClient()->FolderCreate($mFolderNameToCreate, $sParent, true, $sDelimiter);
|
$this->MailClient()->FolderCreate($mFolderNameToCreate, $sParent, true, $sDelimiter);
|
||||||
|
$bDoItAgain = true;
|
||||||
}
|
}
|
||||||
catch (\Throwable $oException)
|
catch (\Throwable $oException)
|
||||||
{
|
{
|
||||||
|
|
@ -172,7 +173,6 @@ trait Folders
|
||||||
'quotaUsage' => $aQuota ? $aQuota[0] * 1024 : null,
|
'quotaUsage' => $aQuota ? $aQuota[0] * 1024 : null,
|
||||||
'quotaLimit' => $aQuota ? $aQuota[1] * 1024 : null,
|
'quotaLimit' => $aQuota ? $aQuota[1] * 1024 : null,
|
||||||
'Namespace' => $sNamespace,
|
'Namespace' => $sNamespace,
|
||||||
'FoldersHash' => \md5(\implode("\x0", $this->recFoldersNames($oFolderCollection))),
|
|
||||||
'IsThreadsSupported' => $this->MailClient()->IsThreadsSupported(),
|
'IsThreadsSupported' => $this->MailClient()->IsThreadsSupported(),
|
||||||
'Optimized' => $oFolderCollection->Optimized,
|
'Optimized' => $oFolderCollection->Optimized,
|
||||||
'CountRec' => $oFolderCollection->TotalCount,
|
'CountRec' => $oFolderCollection->TotalCount,
|
||||||
|
|
@ -470,27 +470,6 @@ trait Folders
|
||||||
$this->SettingsProvider(true)->Save($oAccount, $oSettingsLocal));
|
$this->SettingsProvider(true)->Save($oAccount, $oSettingsLocal));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function recFoldersNames(\MailSo\Mail\FolderCollection $oFolders) : array
|
|
||||||
{
|
|
||||||
$aResult = array();
|
|
||||||
if ($oFolders)
|
|
||||||
{
|
|
||||||
foreach ($oFolders as $oFolder)
|
|
||||||
{
|
|
||||||
$aResult[] = $oFolder->FullName()."|".
|
|
||||||
implode("|", $oFolder->FlagsLowerCase()).($oFolder->IsSubscribed() ? '1' : '0');
|
|
||||||
|
|
||||||
$oSub = $oFolder->SubFolders();
|
|
||||||
if ($oSub && 0 < $oSub->Count())
|
|
||||||
{
|
|
||||||
$aResult = \array_merge($aResult, $this->recFoldersNames($oSub));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $aResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function recFoldersTypes(\RainLoop\Model\Account $oAccount, \MailSo\Mail\FolderCollection $oFolders, array &$aResult, bool $bListFolderTypes = true) : void
|
private function recFoldersTypes(\RainLoop\Model\Account $oAccount, \MailSo\Mail\FolderCollection $oFolders, array &$aResult, bool $bListFolderTypes = true) : void
|
||||||
{
|
{
|
||||||
if ($oFolders->Count())
|
if ($oFolders->Count())
|
||||||
|
|
@ -512,15 +491,6 @@ trait Folders
|
||||||
$aResult[$iFolderType] = $oFolder->FullName();
|
$aResult[$iFolderType] = $oFolder->FullName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($oFolders as $oFolder)
|
|
||||||
{
|
|
||||||
$oSub = $oFolder->SubFolders();
|
|
||||||
if ($oSub && $oSub->Count())
|
|
||||||
{
|
|
||||||
$this->recFoldersTypes($oAccount, $oSub, $aResult, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$aMap = $this->systemFoldersNames($oAccount);
|
$aMap = $this->systemFoldersNames($oAccount);
|
||||||
|
|
@ -545,15 +515,6 @@ trait Folders
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($oFolders as $oFolder)
|
|
||||||
{
|
|
||||||
$oSub = $oFolder->SubFolders();
|
|
||||||
if ($oSub && $oSub->Count())
|
|
||||||
{
|
|
||||||
$this->recFoldersTypes($oAccount, $oSub, $aResult, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -378,7 +378,6 @@ trait Response
|
||||||
array(
|
array(
|
||||||
'Checkable' => \in_array($mResponse->FullName(), $this->aCheckableFolder),
|
'Checkable' => \in_array($mResponse->FullName(), $this->aCheckableFolder),
|
||||||
'Extended' => $aExtended,
|
'Extended' => $aExtended,
|
||||||
'SubFolders' => $this->responseObject($mResponse->SubFolders(), $sParent, $aParameters)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue