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

@ -140,13 +140,10 @@ add_date_and_size(Sexp::List& items, const Message& message)
}
Mu::Sexp::List
Message::to_sexp_list(unsigned docid) const
Message::to_sexp_list() const
{
Sexp::List items;
if (docid != 0)
items.add_prop(":docid", Sexp::make_number(docid));
add_prop_nonempty(items, ":subject", subject());
add_prop_nonempty(items, ":message-id", message_id());
add_prop_nonempty(items, ":mailing-list", mailing_list());
@ -169,7 +166,7 @@ Message::to_sexp_list(unsigned docid) const
}
Mu::Sexp
Message::to_sexp(unsigned docid) const
Message::to_sexp() const
{
return Sexp::make_list(to_sexp_list());
}