diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderType.php b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderType.php index 3a3b1b7b9..4d4e66a68 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderType.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderType.php @@ -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; } diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php index 96d0943ce..1bb007352 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php @@ -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); diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Mail/Folder.php b/rainloop/v/0.0.0/app/libraries/MailSo/Mail/Folder.php index 78617b3fb..6d483b0de 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Mail/Folder.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Mail/Folder.php @@ -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; } } diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Mime/Message.php b/rainloop/v/0.0.0/app/libraries/MailSo/Mime/Message.php index 508e3727d..386970197 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Mime/Message.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Mime/Message.php @@ -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 ) ); diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 085f16872..72cf07ed7 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -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];