mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 16:07:03 +03:00
Added IMAP FolderHierarchyDelimiter() to easily fetch the delimiter
This commit is contained in:
parent
371797cab1
commit
0ba7d3979a
2 changed files with 13 additions and 3 deletions
|
|
@ -527,6 +527,16 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
return $this->specificFolderList(false, $sParentFolderName, $sListPattern, true);
|
return $this->specificFolderList(false, $sParentFolderName, $sListPattern, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \MailSo\Net\Exceptions\Exception
|
||||||
|
* @throws \MailSo\Imap\Exceptions\Exception
|
||||||
|
*/
|
||||||
|
public function FolderHierarchyDelimiter(string $sFolderName = '') : ?string
|
||||||
|
{
|
||||||
|
$oResponse = $this->SendRequestGetResponse('LIST', ['""', $this->EscapeString($sParentFolderName)]);
|
||||||
|
return ('LIST' === $oResponse[0]->ResponseList[1]) ? $oResponse[0]->ResponseList[3] : null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||||
* @throws \MailSo\Net\Exceptions\Exception
|
* @throws \MailSo\Net\Exceptions\Exception
|
||||||
|
|
|
||||||
|
|
@ -2056,8 +2056,8 @@ class MailClient
|
||||||
|
|
||||||
if (!\strlen($sDelimiter) || \strlen($sFolderParentFullNameRaw))
|
if (!\strlen($sDelimiter) || \strlen($sFolderParentFullNameRaw))
|
||||||
{
|
{
|
||||||
$aFolders = $this->oImapClient->FolderList('', \strlen($sFolderParentFullNameRaw) ? $sFolderParentFullNameRaw : 'INBOX');
|
$sDelimiter = $this->oImapClient->FolderHierarchyDelimiter($sFolderParentFullNameRaw);
|
||||||
if (!$aFolders)
|
if (null === $sDelimiter)
|
||||||
{
|
{
|
||||||
// TODO: Translate
|
// TODO: Translate
|
||||||
throw new Exceptions\RuntimeException(
|
throw new Exceptions\RuntimeException(
|
||||||
|
|
@ -2066,7 +2066,6 @@ class MailClient
|
||||||
: 'Cannot get folder delimiter.');
|
: 'Cannot get folder delimiter.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sDelimiter = $aFolders[0]->Delimiter();
|
|
||||||
if (\strlen($sDelimiter) && \strlen($sFolderParentFullNameRaw))
|
if (\strlen($sDelimiter) && \strlen($sFolderParentFullNameRaw))
|
||||||
{
|
{
|
||||||
$sFolderParentFullNameRaw .= $sDelimiter;
|
$sFolderParentFullNameRaw .= $sDelimiter;
|
||||||
|
|
@ -2114,6 +2113,7 @@ class MailClient
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||||
|
* @throws \MailSo\Base\Exceptions\RuntimeException
|
||||||
*/
|
*/
|
||||||
protected function folderModify(string $sPrevFolderFullNameRaw, string $sNextFolderNameInUtf, bool $bRename, bool $bSubscribeOnModify) : self
|
protected function folderModify(string $sPrevFolderFullNameRaw, string $sNextFolderNameInUtf, bool $bRename, bool $bSubscribeOnModify) : self
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue