0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 20:28:52 +02:00

modules/vm: Rename commit hook to issue hook; add opts toggle.

This commit is contained in:
Jason Volk 2019-03-09 12:13:21 -08:00
parent 0a8bb92e6d
commit e501c6434a
3 changed files with 11 additions and 6 deletions

View file

@ -269,6 +269,9 @@ struct ircd::m::vm::copts
/// Whether to log an info message after commit accepted /// Whether to log an info message after commit accepted
bool infolog_postcommit {false}; bool infolog_postcommit {false};
/// Call the issue hook or bypass
bool issue {true};
}; };
struct ircd::m::vm::error struct ircd::m::vm::error

View file

@ -218,7 +218,7 @@ const m::hookfn<m::vm::eval &>
invite_foreign_hookfn invite_foreign_hookfn
{ {
{ {
{ "_site", "vm.commit" }, { "_site", "vm.issue" },
{ "type", "m.room.member" }, { "type", "m.room.member" },
{ "membership", "invite" }, { "membership", "invite" },
}, },

View file

@ -25,7 +25,7 @@ namespace ircd::m::vm
static void init(); static void init();
static void fini(); static void fini();
extern hook::site<eval &> commit_hook; ///< Called when this server issues event extern hook::site<eval &> issue_hook; ///< Called when this server issues event
extern hook::site<eval &> fetch_hook; ///< Called to resolve dependencies extern hook::site<eval &> fetch_hook; ///< Called to resolve dependencies
extern hook::site<eval &> eval_hook; ///< Called when evaluating event extern hook::site<eval &> eval_hook; ///< Called when evaluating event
extern hook::site<eval &> post_hook; ///< Called to apply effects pre-notify extern hook::site<eval &> post_hook; ///< Called to apply effects pre-notify
@ -57,10 +57,10 @@ ircd::m::vm::log_accept_info
{ "default", false }, { "default", false },
}; };
decltype(ircd::m::vm::commit_hook) decltype(ircd::m::vm::issue_hook)
ircd::m::vm::commit_hook ircd::m::vm::issue_hook
{ {
{ "name", "vm.commit" } { "name", "vm.issue" }
}; };
decltype(ircd::m::vm::fetch_hook) decltype(ircd::m::vm::fetch_hook)
@ -469,7 +469,9 @@ try
}; };
check_size(event); check_size(event);
commit_hook(event, eval);
if(eval.copts->issue)
issue_hook(event, eval);
} }
event::conforms report event::conforms report