Diff

core/stanza_router.lua @ 438:193f9dd64f17

Bumper commit for the new modulemanager API \o/ Updates all the modules, though some more changes may be in store.
author Matthew Wild <mwild1@gmail.com>
date Thu, 27 Nov 2008 03:12:12 +0000
parent 372:e7c1e30d06d5
child 468:ab49cb6d0e92
line wrap: on
line diff
--- a/core/stanza_router.lua	Thu Nov 27 03:06:29 2008 +0000
+++ b/core/stanza_router.lua	Thu Nov 27 03:12:12 2008 +0000
@@ -1,9 +1,3 @@
-
--- The code in this file should be self-explanatory, though the logic is horrible
--- for more info on that, see doc/stanza_routing.txt, which attempts to condense
--- the rules from the RFCs (mainly 3921)
-
-require "core.servermanager"
 
 local log = require "util.logger".init("stanzarouter")
 
@@ -82,7 +76,7 @@
 		elseif hosts[to] and hosts[to].type == "local" then -- directed at a local server
 			core_handle_stanza(origin, stanza);
 		elseif stanza.attr.xmlns and stanza.attr.xmlns ~= "jabber:client" and stanza.attr.xmlns ~= "jabber:server" then
-			modules_handle_stanza(origin, stanza);
+			modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza);
 		elseif hosts[to_bare] and hosts[to_bare].type == "component" then -- hack to allow components to handle node@server
 			component_handle_stanza(origin, stanza);
 		elseif hosts[to] and hosts[to].type == "component" then -- hack to allow components to handle node@server/resource and server/resource
@@ -105,7 +99,7 @@
 -- that is, they are handled by this server
 function core_handle_stanza(origin, stanza)
 	-- Handlers
-	if modules_handle_stanza(origin, stanza) then return; end
+	if modules_handle_stanza(stanza.attr.to or origin.host, origin, stanza) then return; end
 	if origin.type == "c2s" or origin.type == "c2s_unauthed" then
 		local session = origin;