Comparison

core/stanza_router.lua @ 9067:89e1bf37ff64

core.stanza_router: Reduce logging of common routing (#776)
author Kim Alvefur <zash@zash.se>
date Sun, 22 Jul 2018 19:44:58 +0200
parent 8347:c72db8047440
child 9070:21730a3642fe
comparison
equal deleted inserted replaced
9066:af97ecd00734 9067:89e1bf37ff64
205 205
206 if hosts[host] then 206 if hosts[host] then
207 -- old stanza routing code removed 207 -- old stanza routing code removed
208 core_post_stanza(origin, stanza); 208 core_post_stanza(origin, stanza);
209 else 209 else
210 log("debug", "Routing to remote...");
211 local host_session = hosts[from_host]; 210 local host_session = hosts[from_host];
212 if not host_session then 211 if not host_session then
213 log("error", "No hosts[from_host] (please report): %s", tostring(stanza)); 212 log("error", "No hosts[from_host] (please report): %s", tostring(stanza));
214 else 213 else
215 local xmlns = stanza.attr.xmlns; 214 local xmlns = stanza.attr.xmlns;
216 stanza.attr.xmlns = nil; 215 stanza.attr.xmlns = nil;
217 local routed = host_session.events.fire_event("route/remote", { 216 local routed = host_session.events.fire_event("route/remote", {
218 origin = origin, stanza = stanza, from_host = from_host, to_host = host }); 217 origin = origin, stanza = stanza, from_host = from_host, to_host = host });
219 stanza.attr.xmlns = xmlns; -- reset 218 stanza.attr.xmlns = xmlns; -- reset
220 if not routed then 219 if not routed then
221 log("debug", "... no, just kidding."); 220 log("debug", "Could not route stanza to remote");
222 if stanza.attr.type == "error" or (stanza.name == "iq" and stanza.attr.type == "result") then return; end 221 if stanza.attr.type == "error" or (stanza.name == "iq" and stanza.attr.type == "result") then return; end
223 core_route_stanza(host_session, st.error_reply(stanza, "cancel", "not-allowed", 222 core_route_stanza(host_session, st.error_reply(stanza, "cancel", "not-allowed",
224 "Communication with remote domains is not enabled")); 223 "Communication with remote domains is not enabled"));
225 end 224 end
226 end 225 end