Software /
code /
prosody
Comparison
core/stanza_router.lua @ 11629:e6e56e2dd996
core.stanza_router: Rename variable to be more specific
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 25 Jun 2021 15:17:37 +0200 |
parent | 10645:067ada779ea5 |
child | 12681:16ea01745dbe |
comparison
equal
deleted
inserted
replaced
11628:0807e835d3b5 | 11629:e6e56e2dd996 |
---|---|
192 core_route_stanza(origin, stanza); | 192 core_route_stanza(origin, stanza); |
193 end | 193 end |
194 end | 194 end |
195 | 195 |
196 function core_route_stanza(origin, stanza) | 196 function core_route_stanza(origin, stanza) |
197 local host = jid_host(stanza.attr.to); | 197 local to_host = jid_host(stanza.attr.to); |
198 local from_host = jid_host(stanza.attr.from); | 198 local from_host = jid_host(stanza.attr.from); |
199 | 199 |
200 -- Auto-detect origin if not specified | 200 -- Auto-detect origin if not specified |
201 origin = origin or hosts[from_host]; | 201 origin = origin or hosts[from_host]; |
202 if not origin then return false; end | 202 if not origin then return false; end |
203 | 203 |
204 if hosts[host] then | 204 if hosts[to_host] then |
205 -- old stanza routing code removed | 205 -- old stanza routing code removed |
206 core_post_stanza(origin, stanza); | 206 core_post_stanza(origin, stanza); |
207 else | 207 else |
208 local host_session = hosts[from_host]; | 208 local host_session = hosts[from_host]; |
209 if not host_session then | 209 if not host_session then |
210 log("error", "No hosts[from_host] (please report): %s", stanza); | 210 log("error", "No hosts[from_host] (please report): %s", stanza); |
211 else | 211 else |
212 local xmlns = stanza.attr.xmlns; | 212 local xmlns = stanza.attr.xmlns; |
213 stanza.attr.xmlns = nil; | 213 stanza.attr.xmlns = nil; |
214 local routed = host_session.events.fire_event("route/remote", { | 214 local routed = host_session.events.fire_event("route/remote", { |
215 origin = origin, stanza = stanza, from_host = from_host, to_host = host }); | 215 origin = origin, stanza = stanza, from_host = from_host, to_host = to_host }); |
216 stanza.attr.xmlns = xmlns; -- reset | 216 stanza.attr.xmlns = xmlns; -- reset |
217 if not routed then | 217 if not routed then |
218 log("debug", "Could not route stanza to remote"); | 218 log("debug", "Could not route stanza to remote"); |
219 if stanza.attr.type == "error" or (stanza.name == "iq" and stanza.attr.type == "result") then return; end | 219 if stanza.attr.type == "error" or (stanza.name == "iq" and stanza.attr.type == "result") then return; end |
220 core_route_stanza(host_session, st.error_reply(stanza, "cancel", "not-allowed", | 220 core_route_stanza(host_session, st.error_reply(stanza, "cancel", "not-allowed", |