# HG changeset patch # User Matthew Wild # Date 1580943239 0 # Node ID 067ada779ea5226b57d27d8caf973ffb7a9d7257 # Parent 6c4ab1b8758881332ec9c3025ba0046db41fbbb5 stanza_router: only fire pre-stanza if firing other preevents (e.g. for c2s sessions) diff -r 6c4ab1b87588 -r 067ada779ea5 core/stanza_router.lua --- a/core/stanza_router.lua Wed Feb 05 23:29:39 2020 +0100 +++ b/core/stanza_router.lua Wed Feb 05 22:53:59 2020 +0000 @@ -174,13 +174,13 @@ 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 + 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 local h = hosts[to_bare] or hosts[host or origin.host];