message/field: cache the message's sexp

Keep it in the store; much faster than generating on the fly.
This commit is contained in:
Dirk-Jan C. Binnema
2022-05-01 01:13:17 +03:00
parent 263e122a13
commit fea596ae3b
7 changed files with 90 additions and 49 deletions

View File

@ -40,7 +40,6 @@ struct Field {
*/
enum struct Id {
Bcc = 0, /**< Blind Carbon-Copy */
BodyHtml, /**< HTML Body */
BodyText, /**< Text body */
Cc, /**< Carbon-Copy */
Date, /**< Message date */
@ -64,6 +63,9 @@ struct Field {
/*
* <private>
*/
XBodyHtml, /**< HTML Body */
XCachedSexp, /**< Cached message s-expression */
_count_ /**< Number of FieldIds */
};
@ -214,15 +216,6 @@ static constexpr std::array<Field, Field::id_size()>
Field::Flag::Contact |
Field::Flag::Value
},
{
Field::Id::BodyHtml,
Field::Type::String,
"body",
"Message html body",
{},
{},
Field::Flag::Internal
},
{
Field::Id::BodyText,
Field::Type::String,
@ -314,7 +307,7 @@ static constexpr std::array<Field, Field::id_size()>
Field::Id::MessageId,
Field::Type::String,
"msgid",
"Attachment MIME-type",
"Message-Id",
"msgid:abc@123",
'i',
Field::Flag::BooleanTerm |
@ -418,6 +411,30 @@ static constexpr std::array<Field, Field::id_size()>
Field::Flag::Contact |
Field::Flag::Value
},
/* internal */
{
Field::Id::XBodyHtml,
Field::Type::String,
"htmlbody",
"Message html body",
{},
{},
Field::Flag::Internal
},
{
Field::Id::XCachedSexp,
Field::Type::String,
"sexp",
"Cached message s-expression",
{},
{},
Field::Flag::Internal |
Field::Flag::Value
},
}};
/*