mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd:Ⓜ️:vm::eval: Add member which caches the m::internal(room) result.
This commit is contained in:
parent
2762361f03
commit
27556f2d9c
2 changed files with 6 additions and 5 deletions
|
@ -88,6 +88,7 @@ struct ircd::m::vm::eval
|
|||
event::conforms report;
|
||||
string_view room_version;
|
||||
const hook::base::site *phase {nullptr};
|
||||
bool room_internal {false};
|
||||
|
||||
static bool for_each_pdu(const std::function<bool (const event &)> &);
|
||||
static const event *find_pdu(const eval &, const event::id &);
|
||||
|
|
|
@ -468,14 +468,14 @@ ircd::m::vm::execute_pdu(eval &eval,
|
|||
at<"type"_>(event)
|
||||
};
|
||||
|
||||
const bool internal
|
||||
const scope_restore room_internal
|
||||
{
|
||||
m::internal(room_id)
|
||||
eval.room_internal, m::internal(room_id)
|
||||
};
|
||||
|
||||
const bool authenticate
|
||||
{
|
||||
opts.auth && !internal
|
||||
opts.auth && !eval.room_internal
|
||||
};
|
||||
|
||||
// The conform hook runs static checks on an event's formatting and
|
||||
|
@ -486,7 +486,7 @@ ircd::m::vm::execute_pdu(eval &eval,
|
|||
call_hook(conform_hook, eval, event, eval);
|
||||
}
|
||||
|
||||
if(unlikely(internal && !my(event)))
|
||||
if(unlikely(eval.room_internal && !my(event)))
|
||||
throw error
|
||||
{
|
||||
fault::GENERAL, "Internal room event denied from external source."
|
||||
|
@ -730,7 +730,7 @@ ircd::m::vm::write_append(eval &eval,
|
|||
//XXX
|
||||
const auto &[pass, fail]
|
||||
{
|
||||
opts.auth && !internal(room.room_id)?
|
||||
opts.auth && !eval.room_internal?
|
||||
room::auth::check(event, room):
|
||||
room::auth::passfail{true, {}}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue