message: add docid param to sexp

This commit is contained in:
Dirk-Jan C. Binnema 2022-04-29 01:25:03 +03:00
parent fccd961712
commit 967e855f6b
3 changed files with 7 additions and 7 deletions

View File

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

View File

@ -279,8 +279,8 @@ public:
* *
* @return a Mu::Sexp or a Mu::Sexp::List representing the message. * @return a Mu::Sexp or a Mu::Sexp::List representing the message.
*/ */
Mu::Sexp::List to_sexp_list() const; Mu::Sexp::List to_sexp_list(unsigned docid=0) const;
Mu::Sexp to_sexp() const; Mu::Sexp to_sexp(unsigned docid=0) const;
/* /*
* And some non-const message, for updating an existing * And some non-const message, for updating an existing

View File

@ -184,7 +184,7 @@ Server::Private::build_message_sexp(const Message& msg,
Store::Id docid, Store::Id docid,
const Option<QueryMatch&> qm) const const Option<QueryMatch&> qm) const
{ {
auto msgsexp{msg.to_sexp_list()}; auto msgsexp{msg.to_sexp_list(docid)};
if (qm) if (qm)
msgsexp.add_prop(":meta", build_metadata(*qm)); msgsexp.add_prop(":meta", build_metadata(*qm));