Software / code / prosody
Comparison
core/stanza_router.lua @ 221:641dbdf3b751
Shortened log output for incoming stanzas and an added check.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Fri, 07 Nov 2008 02:38:44 +0500 |
| parent | 215:ec90acc13ba3 |
| child | 222:6153462397d8 |
comparison
equal
deleted
inserted
replaced
| 219:f06e97f525bc | 221:641dbdf3b751 |
|---|---|
| 29 | 29 |
| 30 local jid_split = require "util.jid".split; | 30 local jid_split = require "util.jid".split; |
| 31 local print = print; | 31 local print = print; |
| 32 | 32 |
| 33 function core_process_stanza(origin, stanza) | 33 function core_process_stanza(origin, stanza) |
| 34 log("debug", "Received["..origin.type.."]: "..tostring(stanza)) | 34 log("debug", "Received["..origin.type.."]: "..tostring(st.reply(st.reply(stanza)))) |
| 35 | 35 |
| 36 -- TODO verify validity of stanza (as well as JID validity) | 36 -- TODO verify validity of stanza (as well as JID validity) |
| 37 if stanza.name == "iq" and not(#stanza.tags == 1 and stanza.tags[1].attr.xmlns) then | 37 if stanza.name == "iq" and not(#stanza.tags == 1 and stanza.tags[1].attr.xmlns) then |
| 38 if stanza.attr.type == "set" or stanza.attr.type == "get" then | 38 if stanza.attr.type == "set" or stanza.attr.type == "get" then |
| 39 error("Invalid IQ"); | 39 error("Invalid IQ"); |
| 79 modules_handle_stanza(origin, stanza); | 79 modules_handle_stanza(origin, stanza); |
| 80 elseif hosts[to_bare] and hosts[to_bare].type == "component" then -- hack to allow components to handle node@server | 80 elseif hosts[to_bare] and hosts[to_bare].type == "component" then -- hack to allow components to handle node@server |
| 81 component_handle_stanza(origin, stanza); | 81 component_handle_stanza(origin, stanza); |
| 82 elseif hosts[to] and hosts[to].type == "component" then -- hack to allow components to handle node@server/resource and server/resource | 82 elseif hosts[to] and hosts[to].type == "component" then -- hack to allow components to handle node@server/resource and server/resource |
| 83 component_handle_stanza(origin, stanza); | 83 component_handle_stanza(origin, stanza); |
| 84 elseif hosts[host].type == "component" then -- directed at a component | 84 elseif hosts[host] and hosts[host].type == "component" then -- directed at a component |
| 85 component_handle_stanza(origin, stanza); | 85 component_handle_stanza(origin, stanza); |
| 86 elseif origin.type == "c2s" and stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then | 86 elseif origin.type == "c2s" and stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then |
| 87 handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare); | 87 handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare); |
| 88 elseif stanza.name == "iq" and not resource then -- directed at bare JID | 88 elseif stanza.name == "iq" and not resource then -- directed at bare JID |
| 89 core_handle_stanza(origin, stanza); | 89 core_handle_stanza(origin, stanza); |