Changeset

10645:067ada779ea5

stanza_router: only fire pre-stanza if firing other preevents (e.g. for c2s sessions)
author Matthew Wild <mwild1@gmail.com>
date Wed, 05 Feb 2020 22:53:59 +0000
parents 10644:6c4ab1b87588
children 10647:d1bfda983ffe
files core/stanza_router.lua
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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];