Merge from waqas

Sat, 08 Nov 2008 00:17:00 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 08 Nov 2008 00:17:00 +0000
changeset 223
d5dffc919b33
parent 222
6153462397d8 (diff)
parent 220
e8edcbce4d46 (current diff)
child 224
4b1e30ddd2bb

Merge from waqas

core/stanza_router.lua file | annotate | diff | comparison | revisions
--- a/core/stanza_router.lua	Sat Nov 08 00:10:01 2008 +0000
+++ b/core/stanza_router.lua	Sat Nov 08 00:17:00 2008 +0000
@@ -31,7 +31,7 @@
 local print = print;
 
 function core_process_stanza(origin, stanza)
-	log("debug", "Received["..origin.type.."]: "..tostring(stanza))
+	log("debug", "Received["..origin.type.."]: "..tostring(st.reply(st.reply(stanza))))
 
 	-- TODO verify validity of stanza (as well as JID validity)
 	if stanza.name == "iq" and not(#stanza.tags == 1 and stanza.tags[1].attr.xmlns) then
@@ -71,26 +71,28 @@
 	end]] -- FIXME
 
 	-- FIXME do stanzas not of jabber:client get handled by components?
-	if not to then
-		core_handle_stanza(origin, stanza);
-	elseif hosts[to] and hosts[to].type == "local" then -- directed at a local server
+	if origin.type == "s2sin" or origin.type == "c2s" then
+		if not to then
+			core_handle_stanza(origin, stanza);
+		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);
+		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
+			component_handle_stanza(origin, stanza);
+		elseif hosts[host] and hosts[host].type == "component" then -- directed at a component
+			component_handle_stanza(origin, stanza);
+		elseif origin.type == "c2s" and stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then
+			handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare);
+		elseif stanza.name == "iq" and not resource then -- directed at bare JID
+			core_handle_stanza(origin, stanza);
+		else
+			core_route_stanza(origin, stanza);
+		end
+	else
 		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);
-	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
-		component_handle_stanza(origin, stanza);
-	elseif hosts[host] and hosts[host].type == "component" then -- directed at a component
-		component_handle_stanza(origin, stanza);
-	elseif origin.type == "c2s" and stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then
-		handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare);
-	elseif stanza.name == "iq" and not resource then -- directed at bare JID
-		core_handle_stanza(origin, stanza);
-	elseif origin.type == "c2s" or origin.type == "s2sin" then
-		core_route_stanza(origin, stanza);
-	else
-		log("warn", "stanza not processed");
 	end
 end
 

mercurial