mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 00:34:18 +01:00
ircd:Ⓜ️ Add a vm::opts* to m:room as a vehicle for opts to eval.
This commit is contained in:
parent
4760d36847
commit
46ef2231ab
3 changed files with 16 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue