mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 16:07:03 +03:00
Bugfix: folder rename/move was broken
This commit is contained in:
parent
792fee547a
commit
c1228d09f0
1 changed files with 13 additions and 13 deletions
|
|
@ -1385,22 +1385,13 @@ class MailClient
|
||||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||||
* @throws \MailSo\Base\Exceptions\RuntimeException
|
* @throws \MailSo\Base\Exceptions\RuntimeException
|
||||||
*/
|
*/
|
||||||
protected function folderModify(string $sPrevFolderFullName, string $sNextFolderNameInUtf, bool $bRename, bool $bSubscribeOnModify) : self
|
protected function folderModify(string $sPrevFolderFullName, string $sNewFolderFullName, bool $bRename, bool $bSubscribeOnModify) : self
|
||||||
{
|
{
|
||||||
if (!\strlen($sPrevFolderFullName) || !\strlen($sNextFolderNameInUtf))
|
if (!\strlen($sPrevFolderFullName) || !\strlen($sNewFolderFullName))
|
||||||
{
|
{
|
||||||
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
|
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sDelimiter = $this->oImapClient->FolderHierarchyDelimiter($sPrevFolderFullName);
|
|
||||||
if (!$sDelimiter)
|
|
||||||
{
|
|
||||||
// TODO: Translate
|
|
||||||
throw new Exceptions\RuntimeException('Cannot '.($bRename?'rename':'move').' non-existent folder.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$iLast = \strrpos($sPrevFolderFullName, $sDelimiter);
|
|
||||||
|
|
||||||
$aSubscribeFolders = array();
|
$aSubscribeFolders = array();
|
||||||
if ($bSubscribeOnModify)
|
if ($bSubscribeOnModify)
|
||||||
{
|
{
|
||||||
|
|
@ -1413,14 +1404,23 @@ class MailClient
|
||||||
|
|
||||||
if ($bRename)
|
if ($bRename)
|
||||||
{
|
{
|
||||||
|
$sDelimiter = $this->oImapClient->FolderHierarchyDelimiter($sPrevFolderFullName);
|
||||||
|
if (!$sDelimiter)
|
||||||
|
{
|
||||||
|
// TODO: Translate
|
||||||
|
throw new Exceptions\RuntimeException('Cannot '.($bRename?'rename':'move').' non-existent folder.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$iLast = \strrpos($sPrevFolderFullName, $sDelimiter);
|
||||||
|
|
||||||
if (\strlen($sDelimiter) && false !== \strpos($sNewFolderFullName, $sDelimiter))
|
if (\strlen($sDelimiter) && false !== \strpos($sNewFolderFullName, $sDelimiter))
|
||||||
{
|
{
|
||||||
// TODO: Translate
|
// TODO: Translate
|
||||||
throw new Exceptions\RuntimeException('New folder name contains delimiter.');
|
throw new Exceptions\RuntimeException('New folder name contains delimiter.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sFolderParentFullName = false === $iLast ? '' : \substr($sPrevFolderFullName, 0, $iLast + 1);
|
$sNewFolderFullName = (false === $iLast ? '' : \substr($sPrevFolderFullName, 0, $iLast + 1))
|
||||||
$sNewFolderFullName = $sFolderParentFullName.$sNewFolderFullName;
|
. $sNewFolderFullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->oImapClient->FolderRename($sPrevFolderFullName, $sNewFolderFullName);
|
$this->oImapClient->FolderRename($sPrevFolderFullName, $sNewFolderFullName);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue