0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 19:58:53 +02:00

ircd:Ⓜ️ Add a vm::opts* to m:room as a vehicle for opts to eval.

This commit is contained in:
Jason Volk 2018-03-28 19:21:52 -07:00
parent 4760d36847
commit 46ef2231ab
3 changed files with 16 additions and 3 deletions

View file

@ -29,6 +29,11 @@ namespace ircd::m::self
bool host(const string_view &);
}
namespace ircd::m::vm
{
struct opts;
}
namespace ircd::m
{
extern struct user me;

View file

@ -98,6 +98,7 @@ struct ircd::m::room
id room_id;
event::id event_id;
const vm::opts *opts {nullptr};
operator const id &() const;
@ -115,13 +116,15 @@ struct ircd::m::room
bool membership(const m::id::user &, const string_view &membership = "join") const;
string_view membership(const mutable_buffer &out, const m::id::user &) const;
room(const id &room_id, const string_view &event_id)
room(const id &room_id, const string_view &event_id, const vm::opts *const &opts = nullptr)
:room_id{room_id}
,event_id{event_id? event::id{event_id} : event::id{}}
,opts{opts}
{}
room(const id &room_id)
room(const id &room_id, const vm::opts *const &opts = nullptr)
:room_id{room_id}
,opts{opts}
{}
room() = default;

View file

@ -248,5 +248,10 @@ commit__iov_iov(const room &room,
{ event, { "prev_events", prev_events } },
};
return m::vm::commit(event, contents);
const vm::opts &vmopts
{
room.opts? *room.opts : vm::default_opts
};
return m::vm::commit(event, contents, vmopts);
}