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 | fd3ee50a8c1aa3029d8edecf584bea8acda9edc7 (patch) | |
tree | 3c1a147a8f14c323983da458f16cc2778bc41f56 /core/stanza_router.lua | |
parent | 0f96c438e5b03eea8d1a1126333b99a3018c0bfb (diff) | |
download | prosody-fd3ee50a8c1aa3029d8edecf584bea8acda9edc7.tar.gz prosody-fd3ee50a8c1aa3029d8edecf584bea8acda9edc7.zip |
stanza_router: Add once-per-routed-stanza event, pre-stanza
Diffstat (limited to 'core/stanza_router.lua')
-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 |