mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-09 17:37:02 +03:00
Revamp mailbox management so that reloading of the whole folder tree is not needed
This commit is contained in:
parent
5fdc38a40d
commit
2719f08e26
8 changed files with 67 additions and 60 deletions
|
|
@ -1309,7 +1309,7 @@ class MailClient
|
|||
/**
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
*/
|
||||
public function FolderCreate(string $sFolderNameInUtf8, string $sFolderParentFullName = '', bool $bSubscribeOnCreation = true, string $sDelimiter = '') : self
|
||||
public function FolderCreate(string $sFolderNameInUtf8, string $sFolderParentFullName = '', bool $bSubscribeOnCreation = true, string $sDelimiter = '') : ?Folder
|
||||
{
|
||||
$sFolderNameInUtf8 = \trim($sFolderNameInUtf8);
|
||||
$sFolderParentFullName = \trim($sFolderParentFullName);
|
||||
|
|
@ -1353,7 +1353,11 @@ class MailClient
|
|||
$this->oImapClient->FolderSubscribe($sFullNameToCreate);
|
||||
}
|
||||
|
||||
return $this;
|
||||
$aFolders = $this->oImapClient->IsSupported('LIST-STATUS')
|
||||
? $this->oImapClient->FolderStatusList($sFullNameToCreate, '')
|
||||
: $this->oImapClient->FolderList($sFullNameToCreate, '');
|
||||
$oImapFolder = $aFolders[$sFullNameToCreate];
|
||||
return $oImapFolder ? new Folder($oImapFolder, $bSubscribeOnCreation) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -119,10 +119,7 @@ trait Folders
|
|||
{
|
||||
try
|
||||
{
|
||||
if ($this->MailClient()->FolderCreate($mFolderNameToCreate, $sParent, true, $sDelimiter))
|
||||
{
|
||||
$bDoItAgain = true;
|
||||
}
|
||||
$this->MailClient()->FolderCreate($mFolderNameToCreate, $sParent, true, $sDelimiter);
|
||||
}
|
||||
catch (\Throwable $oException)
|
||||
{
|
||||
|
|
@ -198,15 +195,16 @@ trait Folders
|
|||
$sFolderNameInUtf = $this->GetActionParam('Folder', '');
|
||||
$sFolderParentFullName = $this->GetActionParam('Parent', '');
|
||||
|
||||
$this->MailClient()->FolderCreate($sFolderNameInUtf, $sFolderParentFullName,
|
||||
$oFolder = $this->MailClient()->FolderCreate($sFolderNameInUtf, $sFolderParentFullName,
|
||||
!!$this->Config()->Get('labs', 'use_imap_list_subscribe', true));
|
||||
|
||||
// FolderInformation(string $sFolderName, int $iPrevUidNext = 0, array $aUids = array())
|
||||
return $this->DefaultResponse(__FUNCTION__, $oFolder);
|
||||
}
|
||||
catch (\Throwable $oException)
|
||||
{
|
||||
throw new ClientException(Notifications::CantCreateFolder, $oException);
|
||||
}
|
||||
|
||||
return $this->TrueResponse(__FUNCTION__);
|
||||
}
|
||||
|
||||
public function DoFolderSetMetadata() : array
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue