MailSo Fixes (remove xlist)

This commit is contained in:
RainLoop Team 2014-09-17 19:25:30 +04:00
parent 6debdee43e
commit 2271712305
5 changed files with 53 additions and 50 deletions

View file

@ -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;
}

View file

@ -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;
@ -711,8 +707,8 @@ class ImapClient extends \MailSo\Net\NetClient
$this->EscapeString($sParentFolderName),
$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);

View file

@ -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;
}
}

View file

@ -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
)
);