mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 06:57:03 +03:00
Added IMAP body text limit
This commit is contained in:
parent
037f4dc61c
commit
0fc8967a7f
5 changed files with 59 additions and 10 deletions
|
|
@ -337,7 +337,8 @@ class MailClient
|
|||
* @param string $sFolderName
|
||||
* @param int $iIndex
|
||||
* @param bool $bIndexIsUid = true
|
||||
* @param mixed $oCacher = null
|
||||
* @param \MailSo\Cache\CacheClient $oCacher = null
|
||||
* @param int $iBodyTextLimit = null
|
||||
*
|
||||
* @return \MailSo\Mail\Message|false
|
||||
*
|
||||
|
|
@ -345,7 +346,7 @@ class MailClient
|
|||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Imap\Exceptions\Exception
|
||||
*/
|
||||
public function Message($sFolderName, $iIndex, $bIndexIsUid = true, $oCacher = null)
|
||||
public function Message($sFolderName, $iIndex, $bIndexIsUid = true, $oCacher = null, $iBodyTextLimit = null)
|
||||
{
|
||||
if (!\MailSo\Base\Validator::RangeInt($iIndex, 1))
|
||||
{
|
||||
|
|
@ -356,7 +357,9 @@ class MailClient
|
|||
|
||||
$oBodyStructure = null;
|
||||
$oMessage = false;
|
||||
|
||||
$aBodyPeekMimeIndexes = array();
|
||||
$aSignatureMimeIndexes = array();
|
||||
|
||||
$aFetchResponse = $this->oImapClient->Fetch(array(\MailSo\Imap\Enumerations\FetchType::BODYSTRUCTURE), $iIndex, $bIndexIsUid);
|
||||
if (0 < \count($aFetchResponse) && isset($aFetchResponse[0]))
|
||||
|
|
@ -369,7 +372,7 @@ class MailClient
|
|||
{
|
||||
foreach ($aTextParts as $oPart)
|
||||
{
|
||||
$aBodyPeekMimeIndexes[] = $oPart->PartID();
|
||||
$aBodyPeekMimeIndexes[] = array($oPart->PartID(), $oPart->Size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -378,7 +381,7 @@ class MailClient
|
|||
{
|
||||
foreach ($aSignatureParts as $oPart)
|
||||
{
|
||||
$aBodyPeekMimeIndexes[] = $oPart->PartID();
|
||||
$aSignatureMimeIndexes[] = $oPart->PartID();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -395,7 +398,21 @@ class MailClient
|
|||
|
||||
if (0 < \count($aBodyPeekMimeIndexes))
|
||||
{
|
||||
foreach ($aBodyPeekMimeIndexes as $sTextMimeIndex)
|
||||
foreach ($aBodyPeekMimeIndexes as $aTextMimeData)
|
||||
{
|
||||
$sLine = \MailSo\Imap\Enumerations\FetchType::BODY_PEEK.'['.$aTextMimeData[0].']';
|
||||
if (\is_numeric($iBodyTextLimit) && 0 < $iBodyTextLimit && $iBodyTextLimit < $aTextMimeData[1])
|
||||
{
|
||||
$sLine .= '<0.'.((int) $iBodyTextLimit).'>';
|
||||
}
|
||||
|
||||
$aFetchItems[] = $sLine;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 < \count($aSignatureMimeIndexes))
|
||||
{
|
||||
foreach ($aSignatureMimeIndexes as $sTextMimeIndex)
|
||||
{
|
||||
$aFetchItems[] = \MailSo\Imap\Enumerations\FetchType::BODY_PEEK.'['.$sTextMimeIndex.']';
|
||||
}
|
||||
|
|
@ -1467,7 +1484,7 @@ class MailClient
|
|||
/**
|
||||
* @param string $sFolderName
|
||||
* @param string $sFolderHash
|
||||
* @param mixed $oCacher
|
||||
* @param \MailSo\Cache\CacheClient $oCacher
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue