mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-09 17:37:02 +03:00
Improved reviveFromJson() for *Model
This commit is contained in:
parent
f4b2fddf5e
commit
76c4f62186
18 changed files with 226 additions and 341 deletions
|
|
@ -255,12 +255,12 @@ class Message implements \JsonSerializable
|
|||
return $this->sPgpSignature;
|
||||
}
|
||||
|
||||
public function PgpSigned() : bool
|
||||
public function isPgpSigned() : bool
|
||||
{
|
||||
return $this->bPgpSigned;
|
||||
}
|
||||
|
||||
public function PgpEncrypted() : bool
|
||||
public function isPgpEncrypted() : bool
|
||||
{
|
||||
return $this->bPgpEncrypted;
|
||||
}
|
||||
|
|
@ -420,11 +420,6 @@ class Message implements \JsonSerializable
|
|||
$this->aThreads = $aThreads;
|
||||
}
|
||||
|
||||
public function TextPartIsTrimmed() : bool
|
||||
{
|
||||
return $this->bTextPartIsTrimmed;
|
||||
}
|
||||
|
||||
public static function NewFetchResponseInstance(string $sFolder, \MailSo\Imap\FetchResponse $oFetchResponse, ?\MailSo\Imap\BodyStructure $oBodyStructure = null) : self
|
||||
{
|
||||
return (new self)->InitByFetchResponse($sFolder, $oFetchResponse, $oBodyStructure);
|
||||
|
|
@ -771,13 +766,13 @@ class Message implements \JsonSerializable
|
|||
'Threads' => $this->Threads(),
|
||||
'Sensitivity' => $this->Sensitivity(),
|
||||
'UnsubsribeLinks' => $this->UnsubsribeLinks(),
|
||||
'ExternalProxy' => false,
|
||||
'ReadReceipt' => '',
|
||||
|
||||
'HasAttachments' => $oAttachments ? 0 < $oAttachments->Count() : false,
|
||||
'AttachmentsSpecData' => $oAttachments ? $oAttachments->SpecData() : array(),
|
||||
|
||||
// Flags
|
||||
'IsUnseen' => \in_array('\\unseen', $aFlags) || !\in_array('\\seen', $aFlags),
|
||||
'IsSeen' => \in_array('\\seen', $aFlags),
|
||||
'IsFlagged' => \in_array('\\flagged', $aFlags),
|
||||
'IsAnswered' => \in_array('\\answered', $aFlags),
|
||||
|
|
|
|||
|
|
@ -372,6 +372,7 @@ trait Folders
|
|||
{
|
||||
$aLowerFlags = array_map('strtolower', $aFlags);
|
||||
$aInboxInformation['Flags'][$iUid] = array(
|
||||
'IsUnseen' => \in_array('\\unseen', $aLowerFlags) || !\in_array('\\seen', $aLowerFlags),
|
||||
'IsSeen' => in_array('\\seen', $aLowerFlags),
|
||||
'IsFlagged' => in_array('\\flagged', $aLowerFlags),
|
||||
'IsAnswered' => in_array('\\answered', $aLowerFlags),
|
||||
|
|
|
|||
|
|
@ -195,6 +195,11 @@ trait Response
|
|||
{
|
||||
if (!($mResponse instanceof \JsonSerializable))
|
||||
{
|
||||
if (\is_object($mResponse))
|
||||
{
|
||||
return '["'.\get_class($mResponse).'"]';
|
||||
}
|
||||
|
||||
if (\is_array($mResponse))
|
||||
{
|
||||
foreach ($mResponse as $iKey => $oItem)
|
||||
|
|
@ -203,11 +208,6 @@ trait Response
|
|||
}
|
||||
}
|
||||
|
||||
if (\is_object($mResponse))
|
||||
{
|
||||
return '["'.\get_class($mResponse).'"]';
|
||||
}
|
||||
|
||||
return $mResponse;
|
||||
}
|
||||
|
||||
|
|
@ -256,8 +256,6 @@ trait Response
|
|||
$mResult['IsReadReceipt'] = true;
|
||||
}
|
||||
|
||||
$mResult['TextPartIsTrimmed'] = false;
|
||||
|
||||
if ('Message' === $sParent)
|
||||
{
|
||||
$oAttachments = /* @var \MailSo\Mail\AttachmentCollection */ $mResponse->Attachments();
|
||||
|
|
@ -323,10 +321,8 @@ trait Response
|
|||
|
||||
$mResult['TextHash'] = \md5($mResult['Html'].$mResult['Plain']);
|
||||
|
||||
$mResult['TextPartIsTrimmed'] = $mResponse->TextPartIsTrimmed();
|
||||
|
||||
$mResult['PgpSigned'] = $mResponse->PgpSigned();
|
||||
$mResult['PgpEncrypted'] = $mResponse->PgpEncrypted();
|
||||
$mResult['isPgpSigned'] = $mResponse->isPgpSigned();
|
||||
$mResult['isPgpEncrypted'] = $mResponse->isPgpEncrypted();
|
||||
$mResult['PgpSignature'] = $mResponse->PgpSignature();
|
||||
|
||||
unset($sHtml, $sPlain);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue