aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-02-05 22:53:59 +0000
committerMatthew Wild <mwild1@gmail.com>2020-02-05 22:53:59 +0000
commite4c3f5d3adef809c3e9c53ec8acb663bc88ac633 (patch)
tree8647d5d368f59e85e5d5336fb3ac48fbdfeac64f /core
parent6e9828ec0333eae14e05bea9e441b69a9398ebbb (diff)
downloadprosody-e4c3f5d3adef809c3e9c53ec8acb663bc88ac633.tar.gz
prosody-e4c3f5d3adef809c3e9c53ec8acb663bc88ac633.zip
stanza_router: only fire pre-stanza if firing other preevents (e.g. for c2s sessions)
Diffstat (limited to 'core')
-rw-r--r--core/stanza_router.lua12
1 files changed, 6 insertions, 6 deletions
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];