diff options
author | Matthew Wild <mwild1@gmail.com> | 2020-02-05 17:40:50 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2020-02-05 17:40:50 +0000 |
commit | 9066d99481cf340ea7ff31db125e1bed3c4882fa (patch) | |
tree | 3c1a147a8f14c323983da458f16cc2778bc41f56 | |
parent | cce028c97a467f2d96f40ed147bf9975cec19249 (diff) | |
download | prosody-9066d99481cf340ea7ff31db125e1bed3c4882fa.tar.gz prosody-9066d99481cf340ea7ff31db125e1bed3c4882fa.zip |
stanza_router: Add once-per-routed-stanza event, pre-stanza
-rw-r--r-- | core/stanza_router.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua index 1d8db3e7..b2712b2f 100644 --- a/core/stanza_router.lua +++ b/core/stanza_router.lua @@ -172,7 +172,14 @@ function core_post_stanza(origin, stanza, preevents) end end - local event_data = {origin=origin, stanza=stanza}; + local event_data = {origin=origin, stanza=stanza, to_self=to_self}; + + local result = hosts[origin.host].events.fire_event("pre-stanza", event_data); + if result ~= nil then + log("debug", "Stanza rejected by pre-stanza handler: %s", event_data.reason or "unknown reason"); + return; + end + if preevents then -- c2s connection if hosts[origin.host].events.fire_event('pre-'..stanza.name..to_type, event_data) then return; end -- do preprocessing end |