Comparison

core/stanza_router.lua @ 4817:9cc1d3e49f19

stanza_router: Fire route/remote per-host
author Matthew Wild <mwild1@gmail.com>
date Fri, 04 May 2012 01:49:13 +0100
parent 4816:897ec7dcdaa6
child 4862:d1cfdb137b03
comparison
equal deleted inserted replaced
4816:897ec7dcdaa6 4817:9cc1d3e49f19
183 if hosts[host] then 183 if hosts[host] then
184 -- old stanza routing code removed 184 -- old stanza routing code removed
185 core_post_stanza(origin, stanza); 185 core_post_stanza(origin, stanza);
186 else 186 else
187 log("debug", "Routing to remote..."); 187 log("debug", "Routing to remote...");
188 if not hosts[from_host] then 188 local host_session = hosts[from_host];
189 if not host_session then
189 log("error", "No hosts[from_host] (please report): %s", tostring(stanza)); 190 log("error", "No hosts[from_host] (please report): %s", tostring(stanza));
190 else 191 else
191 local xmlns = stanza.attr.xmlns; 192 local xmlns = stanza.attr.xmlns;
192 stanza.attr.xmlns = nil; 193 stanza.attr.xmlns = nil;
193 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!) 194 local routed = host_session.events.fire_event("route/remote", { origin = origin, stanza = stanza, from_host = from_host, to_host = host });
194 stanza.attr.xmlns = xmlns; -- reset 195 stanza.attr.xmlns = xmlns; -- reset
195 if not routed then 196 if not routed then
196 core_route_stanza(hosts[from_host], st.error_reply(stanza, "cancel", "not-allowed", "Communication with remote domains is not enabled")); 197 core_route_stanza(host_session, st.error_reply(stanza, "cancel", "not-allowed", "Communication with remote domains is not enabled"));
197 end 198 end
198 end 199 end
199 end 200 end
200 end 201 end