# HG changeset patch # User Matthew Wild # Date 1580924450 0 # Node ID 08e3063eb1aca3cacc7862bff572782499affb7b # Parent 92918212ee83af119fadc167c05a923180d1797e stanza_router: Add once-per-routed-stanza event, pre-stanza diff -r 92918212ee83 -r 08e3063eb1ac core/stanza_router.lua --- a/core/stanza_router.lua Sat Feb 01 00:33:08 2020 +0100 +++ b/core/stanza_router.lua Wed Feb 05 17:40:50 2020 +0000 @@ -172,7 +172,14 @@ 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