Changeset

4817:9cc1d3e49f19

stanza_router: Fire route/remote per-host
author Matthew Wild <mwild1@gmail.com>
date Fri, 04 May 2012 01:49:13 +0100
parents 4816:897ec7dcdaa6
children 4818:3bda6fc02652
files core/stanza_router.lua
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/core/stanza_router.lua	Fri May 04 01:46:54 2012 +0100
+++ b/core/stanza_router.lua	Fri May 04 01:49:13 2012 +0100
@@ -185,15 +185,16 @@
 		core_post_stanza(origin, stanza);
 	else
 		log("debug", "Routing to remote...");
-		if not hosts[from_host] then
+		local host_session = hosts[from_host];
+		if not host_session then
 			log("error", "No hosts[from_host] (please report): %s", tostring(stanza));
 		else
 			local xmlns = stanza.attr.xmlns;
 			stanza.attr.xmlns = nil;
-			local routed = prosody.events.fire_event("route/remote", { origin = origin, stanza = stanza, from_host = from_host, to_host = host }); --FIXME: Should be per-host (shared modules!)
+			local routed = host_session.events.fire_event("route/remote", { origin = origin, stanza = stanza, from_host = from_host, to_host = host });
 			stanza.attr.xmlns = xmlns; -- reset
 			if not routed then
-				core_route_stanza(hosts[from_host], st.error_reply(stanza, "cancel", "not-allowed", "Communication with remote domains is not enabled"));
+				core_route_stanza(host_session, st.error_reply(stanza, "cancel", "not-allowed", "Communication with remote domains is not enabled"));
 			end
 		end
 	end