aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-05-16 01:41:45 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-05-16 01:41:45 +0500
commit32b1d54a24d043bff7f21baaf357b76f40015837 (patch)
tree3d927be268ea6de926d0394b03470840aecf11c4
parent77798443db633a40446a30be5e4ad5c568ef005d (diff)
downloadprosody-32b1d54a24d043bff7f21baaf357b76f40015837.tar.gz
prosody-32b1d54a24d043bff7f21baaf357b76f40015837.zip
stanza_router: Removed global function core_handle_stanza
-rw-r--r--core/modulemanager.lua9
-rw-r--r--core/stanza_router.lua23
2 files changed, 12 insertions, 20 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 6dbc8c53..e0d5ce9b 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -226,7 +226,14 @@ function handle_stanza(host, origin, stanza)
(handlers[1])(origin, stanza);
return true;
else
- log("debug", "Stanza unhandled by any modules, xmlns: %s", stanza.attr.xmlns); -- we didn't handle it
+ log("debug", "Unhandled %s stanza: %s; xmlns=%s", origin.type, stanza.name, xmlns); -- we didn't handle it
+ if stanza.attr.xmlns == "jabber:client" then
+ if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
+ origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
+ end
+ else
+ origin:close("unsupported-stanza-type");
+ end
end
end
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index 3213e986..1640e0ed 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -113,9 +113,9 @@ function core_process_stanza(origin, stanza)
if fire_event(tostring(host or origin.host).."/"..stanza.name, event_data) then
-- event handled
elseif not to then
- core_handle_stanza(origin, stanza);
+ modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza);
elseif hosts[to] and hosts[to].type == "local" then -- directed at a local server
- core_handle_stanza(origin, stanza);
+ modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza);
elseif hosts[to] and hosts[to].type == "component" then -- hack to allow components to handle node@server/resource and server/resource
component_handle_stanza(origin, stanza);
elseif hosts[to_bare] and hosts[to_bare].type == "component" then -- hack to allow components to handle node@server
@@ -123,27 +123,12 @@ function core_process_stanza(origin, stanza)
elseif hosts[host] and hosts[host].type == "component" then -- directed at a component
component_handle_stanza(origin, stanza);
elseif hosts[host] and hosts[host].type == "local" and stanza.name == "iq" and not resource then -- directed at bare JID
- core_handle_stanza(origin, stanza);
+ modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza);
else
core_route_stanza(origin, stanza);
end
else
- core_handle_stanza(origin, stanza);
- end
-end
-
--- This function handles stanzas which are not routed any further,
--- that is, they are handled by this server
-function core_handle_stanza(origin, stanza)
- if not modules_handle_stanza(select(2, jid_split(stanza.attr.to)) or origin.host or origin.to_host, origin, stanza) then
- log("warn", "Unhandled %s stanza: %s", origin.type, tostring(stanza));
- if stanza.attr.xmlns == "jabber:client" then
- if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
- origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
- end
- else
- origin:close("unsupported-stanza-type");
- end
+ modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza);
end
end