mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Remove some unused functions
This commit is contained in:
parent
87df281434
commit
7e42e99019
2 changed files with 7 additions and 51 deletions
|
|
@ -144,26 +144,6 @@ class BodyStructure implements \JsonSerializable
|
||||||
return 'inline' === $this->sDisposition || \strlen($this->sContentID);
|
return 'inline' === $this->sDisposition || \strlen($this->sContentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function IsImage() : bool
|
|
||||||
{
|
|
||||||
return 'image' === \MailSo\Base\Utils::ContentTypeType($this->sContentType, $this->sFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function IsArchive() : bool
|
|
||||||
{
|
|
||||||
return 'archive' === \MailSo\Base\Utils::ContentTypeType($this->sContentType, $this->sFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function IsPdf() : bool
|
|
||||||
{
|
|
||||||
return 'pdf' === \MailSo\Base\Utils::ContentTypeType($this->sContentType, $this->sFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function IsDoc() : bool
|
|
||||||
{
|
|
||||||
return 'doc' === \MailSo\Base\Utils::ContentTypeType($this->sContentType, $this->sFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function IsPgpEncrypted() : bool
|
public function IsPgpEncrypted() : bool
|
||||||
{
|
{
|
||||||
// https://datatracker.ietf.org/doc/html/rfc3156#section-4
|
// https://datatracker.ietf.org/doc/html/rfc3156#section-4
|
||||||
|
|
@ -193,7 +173,7 @@ class BodyStructure implements \JsonSerializable
|
||||||
return \in_array($this->sContentType, ['application/pgp-signature', 'application/pkcs7-signature']);
|
return \in_array($this->sContentType, ['application/pgp-signature', 'application/pkcs7-signature']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function IsAttachBodyPart() : bool
|
public function IsAttachment() : bool
|
||||||
{
|
{
|
||||||
return 'application/pgp-encrypted' !== $this->sContentType
|
return 'application/pgp-encrypted' !== $this->sContentType
|
||||||
&& (
|
&& (
|
||||||
|
|
@ -218,7 +198,7 @@ class BodyStructure implements \JsonSerializable
|
||||||
|
|
||||||
$gParts = $this->SearchByCallback(function ($oItem) {
|
$gParts = $this->SearchByCallback(function ($oItem) {
|
||||||
return ('text/html' === $oItem->sContentType || 'text/plain' === $oItem->sContentType)
|
return ('text/html' === $oItem->sContentType || 'text/plain' === $oItem->sContentType)
|
||||||
&& !$oItem->IsAttachBodyPart();
|
&& !$oItem->IsAttachment();
|
||||||
});
|
});
|
||||||
foreach ($gParts as $oPart) {
|
foreach ($gParts as $oPart) {
|
||||||
$aParts[] = $oPart;
|
$aParts[] = $oPart;
|
||||||
|
|
@ -245,23 +225,19 @@ class BodyStructure implements \JsonSerializable
|
||||||
$gParts = $this->SearchByCallback(function ($oPart) {
|
$gParts = $this->SearchByCallback(function ($oPart) {
|
||||||
return $oPart->Charset()
|
return $oPart->Charset()
|
||||||
&& ('text/html' === $oPart->sContentType || 'text/plain' === $oPart->sContentType)
|
&& ('text/html' === $oPart->sContentType || 'text/plain' === $oPart->sContentType)
|
||||||
&& !$oPart->IsAttachBodyPart();
|
&& !$oPart->IsAttachment();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!$gParts->valid()) {
|
if (!$gParts->valid()) {
|
||||||
$gParts = $this->SearchByCallback(function ($oPart) {
|
$gParts = $this->SearchByCallback(function ($oPart) {
|
||||||
return $oPart->Charset() && $oPart->IsAttachBodyPart();
|
return $oPart->Charset() && $oPart->IsAttachment();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return $gParts->valid() ? $gParts->current()->Charset() : '';
|
return $gParts->valid() ? $gParts->current()->Charset() : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function SearchByCallback(callable $fCallback, /*BodyStructure*/ $parent = null) : iterable
|
||||||
* @param mixed $fCallback
|
|
||||||
*/
|
|
||||||
// public function SearchByCallback($fCallback) : \Generator
|
|
||||||
public function SearchByCallback($fCallback, $parent = null) : iterable
|
|
||||||
{
|
{
|
||||||
if ($fCallback($this, $parent)) {
|
if ($fCallback($this, $parent)) {
|
||||||
yield $this;
|
yield $this;
|
||||||
|
|
@ -274,8 +250,8 @@ class BodyStructure implements \JsonSerializable
|
||||||
public function SearchAttachmentsParts() : iterable
|
public function SearchAttachmentsParts() : iterable
|
||||||
{
|
{
|
||||||
return $this->SearchByCallback(function ($oItem, $oParent) {
|
return $this->SearchByCallback(function ($oItem, $oParent) {
|
||||||
// return $oItem->IsAttachBodyPart();
|
// return $oItem->IsAttachment();
|
||||||
return $oItem->IsAttachBodyPart() && (!$oParent || !$oParent->IsPgpEncrypted());
|
return $oItem->IsAttachment() && (!$oParent || !$oParent->IsPgpEncrypted());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,26 +102,6 @@ class Attachment
|
||||||
return $this->bIsInline;
|
return $this->bIsInline;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function IsImage() : bool
|
|
||||||
{
|
|
||||||
return 'image' === \MailSo\Base\Utils::ContentTypeType($this->ContentType(), $this->sFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function IsArchive() : bool
|
|
||||||
{
|
|
||||||
return 'archive' === \MailSo\Base\Utils::ContentTypeType($this->ContentType(), $this->sFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function IsPdf() : bool
|
|
||||||
{
|
|
||||||
return 'pdf' === \MailSo\Base\Utils::ContentTypeType($this->ContentType(), $this->sFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function IsDoc() : bool
|
|
||||||
{
|
|
||||||
return 'doc' === \MailSo\Base\Utils::ContentTypeType($this->ContentType(), $this->sFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function IsLinked() : bool
|
public function IsLinked() : bool
|
||||||
{
|
{
|
||||||
return $this->bIsLinked && \strlen($this->sCID);
|
return $this->bIsLinked && \strlen($this->sCID);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue