From 428e4fa83263db49891c64389ba404d819902cb1 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 5 Feb 2020 22:53:59 +0000 Subject: stanza_router: only fire pre-stanza if firing other preevents (e.g. for c2s sessions) --- core/stanza_router.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'core') diff --git a/core/stanza_router.lua b/core/stanza_router.lua index b2712b2f..774c077e 100644 --- a/core/stanza_router.lua +++ b/core/stanza_router.lua @@ -174,13 +174,13 @@ function core_post_stanza(origin, stanza, preevents) 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 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]; -- cgit v1.2.3