0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd:Ⓜ️:vm: Add json::array eval ctor.

This commit is contained in:
Jason Volk 2019-02-06 20:54:04 -08:00
parent bb68dfc1e7
commit 70c901a894
2 changed files with 17 additions and 2 deletions

View file

@ -49,13 +49,18 @@ struct ircd::m::vm::eval
uint64_t id {++id_ctr};
ctx::ctx *ctx {ctx::current};
const vm::opts *opts {&default_opts};
const vm::copts *copts {nullptr};
uint64_t sequence {0};
db::txn *txn {nullptr};
string_view room_id;
const json::iov *issue {nullptr};
const event *event_ {nullptr};
uint64_t sequence {0};
db::txn *txn {nullptr};
json::array pdus;
event::id::buf event_id;
public:
@ -68,6 +73,7 @@ struct ircd::m::vm::eval
eval(const vm::opts &);
eval(const vm::copts &);
eval(const event &, const vm::opts & = default_opts);
eval(const json::array &event, const vm::opts & = default_opts);
eval(json::iov &event, const json::iov &content, const vm::copts & = default_copts);
eval(const room &, json::iov &event, const json::iov &content);
eval() = default;

View file

@ -999,6 +999,15 @@ ircd::m::vm::eval::eval(const event &event,
operator()(event);
}
ircd::m::vm::eval::eval(const json::array &event,
const vm::opts &opts)
:opts{&opts}
,pdus{event}
{
for(const json::object &pdu : this->pdus)
operator()(pdu);
}
ircd::m::vm::eval::eval(const vm::copts &opts)
:opts{&opts}
,copts{&opts}