Software /
code /
prosody
Comparison
core/stanza_router.lua @ 7947:24170d74b00b
core: Split some very long lines [luacheck]
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 04 Mar 2017 17:49:48 +0100 |
parent | 7802:802dc0691177 |
child | 8347:c72db8047440 |
comparison
equal
deleted
inserted
replaced
7945:1f4a0e0b7167 | 7947:24170d74b00b |
---|---|
36 -- A normal stanza | 36 -- A normal stanza |
37 local st_type = stanza.attr.type; | 37 local st_type = stanza.attr.type; |
38 if st_type == "error" or (name == "iq" and st_type == "result") then | 38 if st_type == "error" or (name == "iq" and st_type == "result") then |
39 if st_type == "error" then | 39 if st_type == "error" then |
40 local err_type, err_condition, err_message = stanza:get_error(); | 40 local err_type, err_condition, err_message = stanza:get_error(); |
41 log("debug", "Discarding unhandled error %s (%s, %s) from %s: %s", name, err_type, err_condition or "unknown condition", origin_type, stanza:top_tag()); | 41 log("debug", "Discarding unhandled error %s (%s, %s) from %s: %s", |
42 name, err_type, err_condition or "unknown condition", origin_type, stanza:top_tag()); | |
42 else | 43 else |
43 log("debug", "Discarding %s from %s of type: %s", name, origin_type, st_type or '<nil>'); | 44 log("debug", "Discarding %s from %s of type: %s", name, origin_type, st_type or '<nil>'); |
44 end | 45 end |
45 return; | 46 return; |
46 end | 47 end |
50 log("debug", "Unhandled %s stanza: %s; xmlns=%s", origin_type, name, xmlns); | 51 log("debug", "Unhandled %s stanza: %s; xmlns=%s", origin_type, name, xmlns); |
51 if origin.send then | 52 if origin.send then |
52 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | 53 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
53 end | 54 end |
54 else | 55 else |
55 log("warn", "Unhandled %s stream element or stanza: %s; xmlns=%s: %s", origin_type, name, xmlns, tostring(stanza)); -- we didn't handle it | 56 log("warn", "Unhandled %s stream element or stanza: %s; xmlns=%s: %s", |
57 origin_type, name, xmlns, tostring(stanza)); -- we didn't handle it | |
56 origin:close("unsupported-stanza-type"); | 58 origin:close("unsupported-stanza-type"); |
57 end | 59 end |
58 end | 60 end |
59 | 61 |
60 local iq_types = { set=true, get=true, result=true, error=true }; | 62 local iq_types = { set=true, get=true, result=true, error=true }; |
209 if not host_session then | 211 if not host_session then |
210 log("error", "No hosts[from_host] (please report): %s", tostring(stanza)); | 212 log("error", "No hosts[from_host] (please report): %s", tostring(stanza)); |
211 else | 213 else |
212 local xmlns = stanza.attr.xmlns; | 214 local xmlns = stanza.attr.xmlns; |
213 stanza.attr.xmlns = nil; | 215 stanza.attr.xmlns = nil; |
214 local routed = host_session.events.fire_event("route/remote", { origin = origin, stanza = stanza, from_host = from_host, to_host = host }); | 216 local routed = host_session.events.fire_event("route/remote", { |
217 origin = origin, stanza = stanza, from_host = from_host, to_host = host }); | |
215 stanza.attr.xmlns = xmlns; -- reset | 218 stanza.attr.xmlns = xmlns; -- reset |
216 if not routed then | 219 if not routed then |
217 log("debug", "... no, just kidding."); | 220 log("debug", "... no, just kidding."); |
218 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 |
219 core_route_stanza(host_session, st.error_reply(stanza, "cancel", "not-allowed", "Communication with remote domains is not enabled")); | 222 core_route_stanza(host_session, st.error_reply(stanza, "cancel", "not-allowed", |
223 "Communication with remote domains is not enabled")); | |
220 end | 224 end |
221 end | 225 end |
222 end | 226 end |
223 end | 227 end |
224 | 228 |