diff --git a/include/ircd/m/vm/eval.h b/include/ircd/m/vm/eval.h index 95f66bf2f..6a42a2fb0 100644 --- a/include/ircd/m/vm/eval.h +++ b/include/ircd/m/vm/eval.h @@ -15,6 +15,8 @@ namespace ircd::m::vm { struct eval; + string_view evaluator(const eval &) noexcept; + string_view loghead(const mutable_buffer &, const eval &); string_view loghead(const eval &); // single tls buffer diff --git a/include/ircd/m/vm/fault.h b/include/ircd/m/vm/fault.h index fde868c67..cdde44423 100644 --- a/include/ircd/m/vm/fault.h +++ b/include/ircd/m/vm/fault.h @@ -41,4 +41,5 @@ enum ircd::m::vm::fault BOUNCE = 0x0040, ///< The event is not needed at this time. (#bo) DONOTWANT = 0x0080, ///< The event will never be needed (cache this). (#dw) DENIED = 0x0100, ///< Access of evaluator insufficient. (#ad) + IDENT = 0x0200, ///< Identity of evaluator missing. (#id) }; diff --git a/matrix/vm.cc b/matrix/vm.cc index 2e846a47b..4f6aa89fd 100644 --- a/matrix/vm.cc +++ b/matrix/vm.cc @@ -160,6 +160,7 @@ ircd::m::vm::http_code(const fault &code) case fault::BOUNCE: break; case fault::DONOTWANT: break; case fault::DENIED: return http::FORBIDDEN; + case fault::IDENT: return http::UNAUTHORIZED; } return http::INTERNAL_SERVER_ERROR; @@ -180,6 +181,7 @@ ircd::m::vm::reflect(const enum fault &code) case fault::BOUNCE: return "#BOUNCE"; case fault::DONOTWANT: return "#DONOTWANT"; case fault::DENIED: return "#DENIED"; + case fault::IDENT: return "#IDENT"; } return "??????"; diff --git a/matrix/vm_eval.cc b/matrix/vm_eval.cc index a5fd5f9e8..d85307924 100644 --- a/matrix/vm_eval.cc +++ b/matrix/vm_eval.cc @@ -144,6 +144,22 @@ ircd::m::vm::loghead(const mutable_buffer &buf, }; } +ircd::string_view +ircd::m::vm::evaluator(const eval &eval) +noexcept +{ + if(!eval.opts) + return {}; + + if(eval.opts->user_id) + return eval.opts->user_id; + + if(eval.opts->node_id) + return eval.opts->node_id; + + return {}; +} + // // eval::eval //