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 INBOX = 1;
|
||||||
const SENT = 2;
|
const SENT = 2;
|
||||||
const DRAFTS = 3;
|
const DRAFTS = 3;
|
||||||
const SPAM = 4;
|
const JUNK = 4;
|
||||||
const TRASH = 5;
|
const TRASH = 5;
|
||||||
const IMPORTANT = 10;
|
const IMPORTANT = 10;
|
||||||
const STARRED = 11;
|
const FLAGGED = 11;
|
||||||
const ARCHIVE = 12;
|
const ALL = 12;
|
||||||
}
|
}
|
||||||
|
|
|
@ -686,6 +686,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
* @param bool $bIsSubscribeList
|
* @param bool $bIsSubscribeList
|
||||||
* @param string $sParentFolderName = ''
|
* @param string $sParentFolderName = ''
|
||||||
* @param string $sListPattern = '*'
|
* @param string $sListPattern = '*'
|
||||||
|
* @param bool $bUseListStatus = false
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
|
@ -697,12 +698,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
$sCmd = 'LSUB';
|
$sCmd = 'LSUB';
|
||||||
if (!$bIsSubscribeList)
|
if (!$bIsSubscribeList)
|
||||||
{
|
{
|
||||||
if ($bUseListStatus)
|
$sCmd = 'LIST';
|
||||||
{
|
|
||||||
$bUseListStatus = $this->IsSupported('LIST-STATUS');
|
|
||||||
}
|
|
||||||
|
|
||||||
$sCmd = (!$bUseListStatus && $this->IsSupported('XLIST') && !$this->IsSupported('LIST-EXTENDED')) ? 'XLIST' : 'LIST';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sListPattern = 0 === strlen(trim($sListPattern)) ? '*' : $sListPattern;
|
$sListPattern = 0 === strlen(trim($sListPattern)) ? '*' : $sListPattern;
|
||||||
|
@ -711,8 +707,8 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
$this->EscapeString($sParentFolderName),
|
$this->EscapeString($sParentFolderName),
|
||||||
$this->EscapeString($sListPattern)
|
$this->EscapeString($sListPattern)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($bUseListStatus)
|
if ($bUseListStatus && $this->IsSupported('LIST-STATUS'))
|
||||||
{
|
{
|
||||||
$aParameters[] = 'RETURN';
|
$aParameters[] = 'RETURN';
|
||||||
$aParameters[] = array(
|
$aParameters[] = array(
|
||||||
|
@ -724,6 +720,10 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$bUseListStatus = false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->SendRequest($sCmd, $aParameters);
|
$this->SendRequest($sCmd, $aParameters);
|
||||||
|
|
||||||
|
|
|
@ -261,45 +261,47 @@ class Folder
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function GetFolderXListType()
|
public function GetFolderListType()
|
||||||
{
|
{
|
||||||
$aFlags = $this->oImapFolder->FlagsLowerCase();
|
$aFlags = $this->oImapFolder->FlagsLowerCase();
|
||||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::USER;
|
$iListType = \MailSo\Imap\Enumerations\FolderType::USER;
|
||||||
|
|
||||||
if (\is_array($aFlags))
|
if (\is_array($aFlags))
|
||||||
{
|
{
|
||||||
switch (true)
|
switch (true)
|
||||||
{
|
{
|
||||||
case \in_array('\inbox', $aFlags):
|
case \in_array('\inbox', $aFlags) || 'INBOX' === \strtoupper($this->FullNameRaw()):
|
||||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::INBOX;
|
$iListType = \MailSo\Imap\Enumerations\FolderType::INBOX;
|
||||||
break;
|
break;
|
||||||
case \in_array('\sent', $aFlags):
|
case \in_array('\sent', $aFlags):
|
||||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::SENT;
|
$iListType = \MailSo\Imap\Enumerations\FolderType::SENT;
|
||||||
break;
|
break;
|
||||||
case \in_array('\drafts', $aFlags):
|
case \in_array('\drafts', $aFlags):
|
||||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::DRAFTS;
|
$iListType = \MailSo\Imap\Enumerations\FolderType::DRAFTS;
|
||||||
break;
|
break;
|
||||||
|
case \in_array('\junk', $aFlags):
|
||||||
case \in_array('\spam', $aFlags):
|
case \in_array('\spam', $aFlags):
|
||||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::SPAM;
|
$iListType = \MailSo\Imap\Enumerations\FolderType::JUNK;
|
||||||
break;
|
break;
|
||||||
case \in_array('\bin', $aFlags):
|
|
||||||
case \in_array('\trash', $aFlags):
|
case \in_array('\trash', $aFlags):
|
||||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::TRASH;
|
case \in_array('\bin', $aFlags):
|
||||||
|
$iListType = \MailSo\Imap\Enumerations\FolderType::TRASH;
|
||||||
break;
|
break;
|
||||||
case \in_array('\important', $aFlags):
|
case \in_array('\important', $aFlags):
|
||||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::IMPORTANT;
|
$iListType = \MailSo\Imap\Enumerations\FolderType::IMPORTANT;
|
||||||
break;
|
break;
|
||||||
|
case \in_array('\flagged', $aFlags):
|
||||||
case \in_array('\starred', $aFlags):
|
case \in_array('\starred', $aFlags):
|
||||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::STARRED;
|
$iListType = \MailSo\Imap\Enumerations\FolderType::FLAGGED;
|
||||||
break;
|
break;
|
||||||
case \in_array('\all', $aFlags):
|
case \in_array('\all', $aFlags):
|
||||||
case \in_array('\archive', $aFlags):
|
|
||||||
case \in_array('\allmail', $aFlags):
|
case \in_array('\allmail', $aFlags):
|
||||||
$iXListType = \MailSo\Imap\Enumerations\FolderType::ARCHIVE;
|
case \in_array('\archive', $aFlags):
|
||||||
|
$iListType = \MailSo\Imap\Enumerations\FolderType::ALL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $iXListType;
|
return $iListType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -447,7 +447,7 @@ class Message
|
||||||
{
|
{
|
||||||
return $this->AddAlternative(
|
return $this->AddAlternative(
|
||||||
\MailSo\Mime\Enumerations\MimeType::TEXT_PLAIN, trim($sPlain),
|
\MailSo\Mime\Enumerations\MimeType::TEXT_PLAIN, trim($sPlain),
|
||||||
\MailSo\Base\Enumerations\Encoding::QUOTED_PRINTABLE);
|
\MailSo\Base\Enumerations\Encoding::QUOTED_PRINTABLE_LOWER);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param string $sHtml
|
* @param string $sHtml
|
||||||
|
@ -458,7 +458,7 @@ class Message
|
||||||
{
|
{
|
||||||
return $this->AddAlternative(
|
return $this->AddAlternative(
|
||||||
\MailSo\Mime\Enumerations\MimeType::TEXT_HTML, trim($sHtml),
|
\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(
|
$oAttachmentPart->Headers->Add(
|
||||||
Header::NewInstance(
|
Header::NewInstance(
|
||||||
\MailSo\Mime\Enumerations\Header::CONTENT_TRANSFER_ENCODING,
|
\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 Mail' => \MailSo\Imap\Enumerations\FolderType::DRAFTS,
|
||||||
'Drafts Mails' => \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,
|
'Junk' => \MailSo\Imap\Enumerations\FolderType::JUNK,
|
||||||
'Bulk Mail' => \MailSo\Imap\Enumerations\FolderType::SPAM,
|
'Bulk Mail' => \MailSo\Imap\Enumerations\FolderType::JUNK,
|
||||||
'Bulk Mails' => \MailSo\Imap\Enumerations\FolderType::SPAM,
|
'Bulk Mails' => \MailSo\Imap\Enumerations\FolderType::JUNK,
|
||||||
|
|
||||||
'Trash' => \MailSo\Imap\Enumerations\FolderType::TRASH,
|
'Trash' => \MailSo\Imap\Enumerations\FolderType::TRASH,
|
||||||
'Deleted' => \MailSo\Imap\Enumerations\FolderType::TRASH,
|
'Deleted' => \MailSo\Imap\Enumerations\FolderType::TRASH,
|
||||||
'Bin' => \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' => \MailSo\Imap\Enumerations\FolderType::ALL,
|
||||||
'All Mail' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE,
|
'All Mail' => \MailSo\Imap\Enumerations\FolderType::ALL,
|
||||||
'All Mails' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE,
|
'All Mails' => \MailSo\Imap\Enumerations\FolderType::ALL,
|
||||||
'AllMail' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE,
|
'AllMail' => \MailSo\Imap\Enumerations\FolderType::ALL,
|
||||||
'AllMails' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE,
|
'AllMails' => \MailSo\Imap\Enumerations\FolderType::ALL,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->Plugins()->RunHook('filter.system-folders-names', array($oAccount, &$aCache));
|
$this->Plugins()->RunHook('filter.system-folders-names', array($oAccount, &$aCache));
|
||||||
|
@ -3815,29 +3815,29 @@ class Actions
|
||||||
* @param \RainLoop\Account $oAccount
|
* @param \RainLoop\Account $oAccount
|
||||||
* @param \MailSo\Mail\FolderCollection $oFolders
|
* @param \MailSo\Mail\FolderCollection $oFolders
|
||||||
* @param array $aResult
|
* @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)
|
if ($oFolders)
|
||||||
{
|
{
|
||||||
$aFolders =& $oFolders->GetAsArray();
|
$aFolders =& $oFolders->GetAsArray();
|
||||||
if (\is_array($aFolders) && 0 < \count($aFolders))
|
if (\is_array($aFolders) && 0 < \count($aFolders))
|
||||||
{
|
{
|
||||||
if ($bXList)
|
if ($bListFolderTypes)
|
||||||
{
|
{
|
||||||
foreach ($aFolders as $oFolder)
|
foreach ($aFolders as $oFolder)
|
||||||
{
|
{
|
||||||
$iFolderXListType = $oFolder->GetFolderXListType();
|
$iFolderListType = $oFolder->GetFolderListType();
|
||||||
if (!isset($aResult[$iFolderXListType]) && \in_array($iFolderXListType, array(
|
if (!isset($aResult[$iFolderListType]) && \in_array($iFolderListType, array(
|
||||||
\MailSo\Imap\Enumerations\FolderType::SENT,
|
\MailSo\Imap\Enumerations\FolderType::SENT,
|
||||||
\MailSo\Imap\Enumerations\FolderType::DRAFTS,
|
\MailSo\Imap\Enumerations\FolderType::DRAFTS,
|
||||||
\MailSo\Imap\Enumerations\FolderType::SPAM,
|
\MailSo\Imap\Enumerations\FolderType::JUNK,
|
||||||
\MailSo\Imap\Enumerations\FolderType::TRASH,
|
\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();
|
$oSub = $oFolder->SubFolders();
|
||||||
|
@ -3858,9 +3858,9 @@ class Actions
|
||||||
if (!isset($aResult[$iFolderType]) && \in_array($iFolderType, array(
|
if (!isset($aResult[$iFolderType]) && \in_array($iFolderType, array(
|
||||||
\MailSo\Imap\Enumerations\FolderType::SENT,
|
\MailSo\Imap\Enumerations\FolderType::SENT,
|
||||||
\MailSo\Imap\Enumerations\FolderType::DRAFTS,
|
\MailSo\Imap\Enumerations\FolderType::DRAFTS,
|
||||||
\MailSo\Imap\Enumerations\FolderType::SPAM,
|
\MailSo\Imap\Enumerations\FolderType::JUNK,
|
||||||
\MailSo\Imap\Enumerations\FolderType::TRASH,
|
\MailSo\Imap\Enumerations\FolderType::TRASH,
|
||||||
\MailSo\Imap\Enumerations\FolderType::ARCHIVE
|
\MailSo\Imap\Enumerations\FolderType::ALL
|
||||||
)))
|
)))
|
||||||
{
|
{
|
||||||
$aResult[$iFolderType] = $oFolder->FullNameRaw();
|
$aResult[$iFolderType] = $oFolder->FullNameRaw();
|
||||||
|
@ -3927,7 +3927,7 @@ class Actions
|
||||||
}
|
}
|
||||||
if ('' === $this->GetActionParam('SpamFolder', ''))
|
if ('' === $this->GetActionParam('SpamFolder', ''))
|
||||||
{
|
{
|
||||||
$aList[] = \MailSo\Imap\Enumerations\FolderType::SPAM;
|
$aList[] = \MailSo\Imap\Enumerations\FolderType::JUNK;
|
||||||
}
|
}
|
||||||
if ('' === $this->GetActionParam('TrashFolder', ''))
|
if ('' === $this->GetActionParam('TrashFolder', ''))
|
||||||
{
|
{
|
||||||
|
@ -3935,7 +3935,7 @@ class Actions
|
||||||
}
|
}
|
||||||
if ('' === $this->GetActionParam('ArchiveFolder', ''))
|
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));
|
$this->Plugins()->RunHook('filter.folders-system-types', array($oAccount, &$aList));
|
||||||
|
@ -4236,6 +4236,7 @@ class Actions
|
||||||
|
|
||||||
$sRawKey = $this->GetActionParam('RawKey', '');
|
$sRawKey = $this->GetActionParam('RawKey', '');
|
||||||
$aValues = $this->getDecodedClientRawKeyValue($sRawKey, 9);
|
$aValues = $this->getDecodedClientRawKeyValue($sRawKey, 9);
|
||||||
|
|
||||||
if (is_array($aValues) && 9 === count($aValues))
|
if (is_array($aValues) && 9 === count($aValues))
|
||||||
{
|
{
|
||||||
$sFolder =(string) $aValues[0];
|
$sFolder =(string) $aValues[0];
|
||||||
|
|
Loading…
Reference in a new issue