mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Support RFC5258 to prevent LSUB roundtrip
This commit is contained in:
parent
934431c6be
commit
f992a06b63
4 changed files with 14 additions and 7 deletions
|
|
@ -473,6 +473,11 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$bUseListStatus = false;
|
$bUseListStatus = false;
|
||||||
|
// RFC5258
|
||||||
|
if ($this->IsSupported('LIST-EXTENDED')) {
|
||||||
|
$aParameters[] = 'RETURN';
|
||||||
|
$aParameters[] = array('SUBSCRIBED'/*,'CHILDREN'*/);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$aReturn = $this->SendRequestGetResponse($sCmd, $aParameters)->getFoldersResult($sCmd, $bUseListStatus);
|
$aReturn = $this->SendRequestGetResponse($sCmd, $aParameters)->getFoldersResult($sCmd, $bUseListStatus);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class Folder implements \JsonSerializable
|
||||||
$this->sParentFullNameRaw = \implode($this->oImapFolder->Delimiter(), $aNames);
|
$this->sParentFullNameRaw = \implode($this->oImapFolder->Delimiter(), $aNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->bSubscribed = $bSubscribed;
|
$this->bSubscribed = $bSubscribed || \in_array('\\subscribed', $oImapFolder->FlagsLowerCase());
|
||||||
$this->bExists = $bExists;
|
$this->bExists = $bExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1915,8 +1915,10 @@ class MailClient
|
||||||
public function Folders(string $sParent = '', string $sListPattern = '*', bool $bUseListSubscribeStatus = true, int $iOptimizationLimit = 0) : ?FolderCollection
|
public function Folders(string $sParent = '', string $sListPattern = '*', bool $bUseListSubscribeStatus = true, int $iOptimizationLimit = 0) : ?FolderCollection
|
||||||
{
|
{
|
||||||
$aImapSubscribedFoldersHelper = null;
|
$aImapSubscribedFoldersHelper = null;
|
||||||
if ($bUseListSubscribeStatus)
|
if ($this->oImapClient->IsSupported('LIST-EXTENDED')) {
|
||||||
{
|
$bUseListSubscribeStatus = false;
|
||||||
|
} else if ($bUseListSubscribeStatus) {
|
||||||
|
//\error_log('RFC5258 not supported, using LSUB');
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$aSubscribedFolders = $this->oImapClient->FolderSubscribeList($sParent, $sListPattern);
|
$aSubscribedFolders = $this->oImapClient->FolderSubscribeList($sParent, $sListPattern);
|
||||||
|
|
@ -1928,7 +1930,7 @@ class MailClient
|
||||||
}
|
}
|
||||||
catch (\Throwable $oException)
|
catch (\Throwable $oException)
|
||||||
{
|
{
|
||||||
unset($oException);
|
\error_log('ERROR FolderSubscribeList: ' . $oException->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1941,8 +1943,8 @@ class MailClient
|
||||||
foreach ($aFolders as /* @var $oImapFolder \MailSo\Imap\Folder */ $oImapFolder)
|
foreach ($aFolders as /* @var $oImapFolder \MailSo\Imap\Folder */ $oImapFolder)
|
||||||
{
|
{
|
||||||
$aMailFoldersHelper[] = new Folder($oImapFolder,
|
$aMailFoldersHelper[] = new Folder($oImapFolder,
|
||||||
(null === $aImapSubscribedFoldersHelper || \in_array($oImapFolder->FullNameRaw(), $aImapSubscribedFoldersHelper)) ||
|
($bUseListSubscribeStatus && (null === $aImapSubscribedFoldersHelper || \in_array($oImapFolder->FullNameRaw(), $aImapSubscribedFoldersHelper)))
|
||||||
$oImapFolder->IsInbox()
|
|| $oImapFolder->IsInbox()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ trait Folders
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->MailClient()->FolderSubscribe($sFolderFullNameRaw, !!$bSubscribe);
|
$this->MailClient()->FolderSubscribe($sFolderFullNameRaw, $bSubscribe);
|
||||||
}
|
}
|
||||||
catch (\Throwable $oException)
|
catch (\Throwable $oException)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue