Redirecting all stanzas not from origin of type s2sin and c2s to core_handle_stanza

Sat, 08 Nov 2008 05:06:22 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Sat, 08 Nov 2008 05:06:22 +0500
changeset 222
6153462397d8
parent 221
641dbdf3b751
child 223
d5dffc919b33

Redirecting all stanzas not from origin of type s2sin and c2s to core_handle_stanza

core/stanza_router.lua file | annotate | diff | comparison | revisions
--- a/core/stanza_router.lua	Fri Nov 07 02:38:44 2008 +0500
+++ b/core/stanza_router.lua	Sat Nov 08 05:06:22 2008 +0500
@@ -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