mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-30 18:49:46 +08:00
MailSo Fixes (remove xlist)
This commit is contained in:
parent
6debdee43e
commit
2271712305
5 changed files with 53 additions and 50 deletions
|
@ -13,9 +13,9 @@ class FolderType
|
|||
const INBOX = 1;
|
||||
const SENT = 2;
|
||||
const DRAFTS = 3;
|
||||
const SPAM = 4;
|
||||
const JUNK = 4;
|
||||
const TRASH = 5;
|
||||
const IMPORTANT = 10;
|
||||
const STARRED = 11;
|
||||
const ARCHIVE = 12;
|
||||
const FLAGGED = 11;
|
||||
const ALL = 12;
|
||||
}
|
||||
|
|
|
@ -686,6 +686,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
* @param bool $bIsSubscribeList
|
||||
* @param string $sParentFolderName = ''
|
||||
* @param string $sListPattern = '*'
|
||||
* @param bool $bUseListStatus = false
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
|
@ -697,12 +698,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
$sCmd = 'LSUB';
|
||||
if (!$bIsSubscribeList)
|
||||
{
|
||||
if ($bUseListStatus)
|
||||
{
|
||||
$bUseListStatus = $this->IsSupported('LIST-STATUS');
|
||||
}
|
||||
|
||||
$sCmd = (!$bUseListStatus && $this->IsSupported('XLIST') && !$this->IsSupported('LIST-EXTENDED')) ? 'XLIST' : 'LIST';
|
||||
$sCmd = 'LIST';
|
||||
}
|
||||
|
||||
$sListPattern = 0 === strlen(trim($sListPattern)) ? '*' : $sListPattern;
|
||||
|
@ -712,7 +708,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
$this->EscapeString($sListPattern)
|
||||
);
|
||||
|
||||
if ($bUseListStatus)
|
||||
if ($bUseListStatus && $this->IsSupported('LIST-STATUS'))
|
||||
{
|
||||
$aParameters[] = 'RETURN';
|
||||
$aParameters[] = array(
|
||||
|
@ -724,6 +720,10 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$bUseListStatus = false;
|
||||
}
|
||||
|
||||
$this->SendRequest($sCmd, $aParameters);
|
||||
|
||||
|
|
|
@ -261,45 +261,47 @@ class Folder
|
|||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function GetFolderXListType()
|
||||
public function GetFolderListType()
|
||||
{
|
||||
$aFlags = $this->oImapFolder->FlagsLowerCase();
|
||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::USER;
|
||||
$iListType = \MailSo\Imap\Enumerations\FolderType::USER;
|
||||
|
||||
if (\is_array($aFlags))
|
||||
{
|
||||
switch (true)
|
||||
{
|
||||
case \in_array('\inbox', $aFlags):
|
||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::INBOX;
|
||||
case \in_array('\inbox', $aFlags) || 'INBOX' === \strtoupper($this->FullNameRaw()):
|
||||
$iListType = \MailSo\Imap\Enumerations\FolderType::INBOX;
|
||||
break;
|
||||
case \in_array('\sent', $aFlags):
|
||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::SENT;
|
||||
$iListType = \MailSo\Imap\Enumerations\FolderType::SENT;
|
||||
break;
|
||||
case \in_array('\drafts', $aFlags):
|
||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::DRAFTS;
|
||||
$iListType = \MailSo\Imap\Enumerations\FolderType::DRAFTS;
|
||||
break;
|
||||
case \in_array('\junk', $aFlags):
|
||||
case \in_array('\spam', $aFlags):
|
||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::SPAM;
|
||||
$iListType = \MailSo\Imap\Enumerations\FolderType::JUNK;
|
||||
break;
|
||||
case \in_array('\bin', $aFlags):
|
||||
case \in_array('\trash', $aFlags):
|
||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::TRASH;
|
||||
case \in_array('\bin', $aFlags):
|
||||
$iListType = \MailSo\Imap\Enumerations\FolderType::TRASH;
|
||||
break;
|
||||
case \in_array('\important', $aFlags):
|
||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::IMPORTANT;
|
||||
$iListType = \MailSo\Imap\Enumerations\FolderType::IMPORTANT;
|
||||
break;
|
||||
case \in_array('\flagged', $aFlags):
|
||||
case \in_array('\starred', $aFlags):
|
||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::STARRED;
|
||||
$iListType = \MailSo\Imap\Enumerations\FolderType::FLAGGED;
|
||||
break;
|
||||
case \in_array('\all', $aFlags):
|
||||
case \in_array('\archive', $aFlags):
|
||||
case \in_array('\allmail', $aFlags):
|
||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::ARCHIVE;
|
||||
case \in_array('\archive', $aFlags):
|
||||
$iListType = \MailSo\Imap\Enumerations\FolderType::ALL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $iXListType;
|
||||
return $iListType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -447,7 +447,7 @@ class Message
|
|||
{
|
||||
return $this->AddAlternative(
|
||||
\MailSo\Mime\Enumerations\MimeType::TEXT_PLAIN, trim($sPlain),
|
||||
\MailSo\Base\Enumerations\Encoding::QUOTED_PRINTABLE);
|
||||
\MailSo\Base\Enumerations\Encoding::QUOTED_PRINTABLE_LOWER);
|
||||
}
|
||||
/**
|
||||
* @param string $sHtml
|
||||
|
@ -458,7 +458,7 @@ class Message
|
|||
{
|
||||
return $this->AddAlternative(
|
||||
\MailSo\Mime\Enumerations\MimeType::TEXT_HTML, trim($sHtml),
|
||||
\MailSo\Base\Enumerations\Encoding::QUOTED_PRINTABLE);
|
||||
\MailSo\Base\Enumerations\Encoding::QUOTED_PRINTABLE_LOWER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -583,7 +583,7 @@ class Message
|
|||
$oAttachmentPart->Headers->Add(
|
||||
Header::NewInstance(
|
||||
\MailSo\Mime\Enumerations\Header::CONTENT_TRANSFER_ENCODING,
|
||||
\MailSo\Base\Enumerations\Encoding::BASE64
|
||||
\MailSo\Base\Enumerations\Encoding::BASE64_LOWER
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -3786,23 +3786,23 @@ class Actions
|
|||
'Drafts Mail' => \MailSo\Imap\Enumerations\FolderType::DRAFTS,
|
||||
'Drafts Mails' => \MailSo\Imap\Enumerations\FolderType::DRAFTS,
|
||||
|
||||
'Spam' => \MailSo\Imap\Enumerations\FolderType::SPAM,
|
||||
'Spam' => \MailSo\Imap\Enumerations\FolderType::JUNK,
|
||||
|
||||
'Junk' => \MailSo\Imap\Enumerations\FolderType::SPAM,
|
||||
'Bulk Mail' => \MailSo\Imap\Enumerations\FolderType::SPAM,
|
||||
'Bulk Mails' => \MailSo\Imap\Enumerations\FolderType::SPAM,
|
||||
'Junk' => \MailSo\Imap\Enumerations\FolderType::JUNK,
|
||||
'Bulk Mail' => \MailSo\Imap\Enumerations\FolderType::JUNK,
|
||||
'Bulk Mails' => \MailSo\Imap\Enumerations\FolderType::JUNK,
|
||||
|
||||
'Trash' => \MailSo\Imap\Enumerations\FolderType::TRASH,
|
||||
'Deleted' => \MailSo\Imap\Enumerations\FolderType::TRASH,
|
||||
'Bin' => \MailSo\Imap\Enumerations\FolderType::TRASH,
|
||||
|
||||
'Archive' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE,
|
||||
'Archive' => \MailSo\Imap\Enumerations\FolderType::ALL,
|
||||
|
||||
'All' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE,
|
||||
'All Mail' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE,
|
||||
'All Mails' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE,
|
||||
'AllMail' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE,
|
||||
'AllMails' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE,
|
||||
'All' => \MailSo\Imap\Enumerations\FolderType::ALL,
|
||||
'All Mail' => \MailSo\Imap\Enumerations\FolderType::ALL,
|
||||
'All Mails' => \MailSo\Imap\Enumerations\FolderType::ALL,
|
||||
'AllMail' => \MailSo\Imap\Enumerations\FolderType::ALL,
|
||||
'AllMails' => \MailSo\Imap\Enumerations\FolderType::ALL,
|
||||
);
|
||||
|
||||
$this->Plugins()->RunHook('filter.system-folders-names', array($oAccount, &$aCache));
|
||||
|
@ -3815,29 +3815,29 @@ class Actions
|
|||
* @param \RainLoop\Account $oAccount
|
||||
* @param \MailSo\Mail\FolderCollection $oFolders
|
||||
* @param array $aResult
|
||||
* @param bool $bXList = true
|
||||
* @param bool $bListFolderTypes = true
|
||||
*/
|
||||
private function recFoldersTypes($oAccount, $oFolders, &$aResult, $bXList = true)
|
||||
private function recFoldersTypes($oAccount, $oFolders, &$aResult, $bListFolderTypes = true)
|
||||
{
|
||||
if ($oFolders)
|
||||
{
|
||||
$aFolders =& $oFolders->GetAsArray();
|
||||
if (\is_array($aFolders) && 0 < \count($aFolders))
|
||||
{
|
||||
if ($bXList)
|
||||
if ($bListFolderTypes)
|
||||
{
|
||||
foreach ($aFolders as $oFolder)
|
||||
{
|
||||
$iFolderXListType = $oFolder->GetFolderXListType();
|
||||
if (!isset($aResult[$iFolderXListType]) && \in_array($iFolderXListType, array(
|
||||
$iFolderListType = $oFolder->GetFolderListType();
|
||||
if (!isset($aResult[$iFolderListType]) && \in_array($iFolderListType, array(
|
||||
\MailSo\Imap\Enumerations\FolderType::SENT,
|
||||
\MailSo\Imap\Enumerations\FolderType::DRAFTS,
|
||||
\MailSo\Imap\Enumerations\FolderType::SPAM,
|
||||
\MailSo\Imap\Enumerations\FolderType::JUNK,
|
||||
\MailSo\Imap\Enumerations\FolderType::TRASH,
|
||||
\MailSo\Imap\Enumerations\FolderType::ARCHIVE
|
||||
\MailSo\Imap\Enumerations\FolderType::ALL
|
||||
)))
|
||||
{
|
||||
$aResult[$iFolderXListType] = $oFolder->FullNameRaw();
|
||||
$aResult[$iFolderListType] = $oFolder->FullNameRaw();
|
||||
}
|
||||
|
||||
$oSub = $oFolder->SubFolders();
|
||||
|
@ -3858,9 +3858,9 @@ class Actions
|
|||
if (!isset($aResult[$iFolderType]) && \in_array($iFolderType, array(
|
||||
\MailSo\Imap\Enumerations\FolderType::SENT,
|
||||
\MailSo\Imap\Enumerations\FolderType::DRAFTS,
|
||||
\MailSo\Imap\Enumerations\FolderType::SPAM,
|
||||
\MailSo\Imap\Enumerations\FolderType::JUNK,
|
||||
\MailSo\Imap\Enumerations\FolderType::TRASH,
|
||||
\MailSo\Imap\Enumerations\FolderType::ARCHIVE
|
||||
\MailSo\Imap\Enumerations\FolderType::ALL
|
||||
)))
|
||||
{
|
||||
$aResult[$iFolderType] = $oFolder->FullNameRaw();
|
||||
|
@ -3927,7 +3927,7 @@ class Actions
|
|||
}
|
||||
if ('' === $this->GetActionParam('SpamFolder', ''))
|
||||
{
|
||||
$aList[] = \MailSo\Imap\Enumerations\FolderType::SPAM;
|
||||
$aList[] = \MailSo\Imap\Enumerations\FolderType::JUNK;
|
||||
}
|
||||
if ('' === $this->GetActionParam('TrashFolder', ''))
|
||||
{
|
||||
|
@ -3935,7 +3935,7 @@ class Actions
|
|||
}
|
||||
if ('' === $this->GetActionParam('ArchiveFolder', ''))
|
||||
{
|
||||
$aList[] = \MailSo\Imap\Enumerations\FolderType::ARCHIVE;
|
||||
$aList[] = \MailSo\Imap\Enumerations\FolderType::ALL;
|
||||
}
|
||||
|
||||
$this->Plugins()->RunHook('filter.folders-system-types', array($oAccount, &$aList));
|
||||
|
@ -4236,6 +4236,7 @@ class Actions
|
|||
|
||||
$sRawKey = $this->GetActionParam('RawKey', '');
|
||||
$aValues = $this->getDecodedClientRawKeyValue($sRawKey, 9);
|
||||
|
||||
if (is_array($aValues) && 9 === count($aValues))
|
||||
{
|
||||
$sFolder =(string) $aValues[0];
|
||||
|
|
Loading…
Reference in a new issue