diff --git a/include/ircd/m/vm.h b/include/ircd/m/vm.h index 0d7ace705..a2e83896b 100644 --- a/include/ircd/m/vm.h +++ b/include/ircd/m/vm.h @@ -113,17 +113,17 @@ enum ircd::m::vm::fault /// Evaluation Options struct ircd::m::vm::opts { - /// Make writes to database - bool write {true}; - /// Make fetches or false to bypass fetch stage. bool fetch {true}; /// Call eval hooks or false to bypass this stage. bool eval {true}; - /// Apply effects of this event or false to bypass this stage. - bool effects {true}; + /// Make writes to database + bool write {true}; + + /// Call post hooks or false to bypass post-write / pre-notify effects. + bool post {true}; /// Broadcast to clients/servers. When true, individual notify options /// that follow are considered. When false, no notifications occur. @@ -135,6 +135,9 @@ struct ircd::m::vm::opts /// Broadcast to federation servers (/federation/send/). bool notify_servers {true}; + /// Apply effects of this event or false to bypass this stage. + bool effects {true}; + /// False to allow a dirty conforms report (not recommended). bool conforming {true}; diff --git a/modules/vm.cc b/modules/vm.cc index ec307849d..925c21584 100644 --- a/modules/vm.cc +++ b/modules/vm.cc @@ -25,11 +25,12 @@ namespace ircd::m::vm static void init(); static void fini(); - extern hook::site commit_hook; ///< Called when this server issues event - extern hook::site fetch_hook; ///< Called to resolve dependencies - extern hook::site eval_hook; ///< Called when evaluating event - extern hook::site notify_hook; ///< Called to broadcast successful eval - extern hook::site effect_hook; ///< Called to apply effects of eval + extern hook::site commit_hook; ///< Called when this server issues event + extern hook::site fetch_hook; ///< Called to resolve dependencies + extern hook::site eval_hook; ///< Called when evaluating event + extern hook::site post_hook; ///< Called to apply effects pre-notify + extern hook::site notify_hook; ///< Called to broadcast successful eval + extern hook::site effect_hook; ///< Called to apply effects post-notify extern conf::item log_accept_debug; extern conf::item log_accept_info; @@ -74,6 +75,12 @@ ircd::m::vm::eval_hook { "name", "vm.eval" } }; +decltype(ircd::m::vm::post_hook) +ircd::m::vm::post_hook +{ + { "name", "vm.post" } +}; + decltype(ircd::m::vm::notify_hook) ircd::m::vm::notify_hook { @@ -491,6 +498,9 @@ try if(ret != fault::ACCEPT) return ret; + if(opts.post) + post_hook(event, eval); + if(opts.notify) notify_hook(event, eval);