Changeset

372:e7c1e30d06d5

Now possible to specify nil origin to core_route_stanza. Origin will be chosen as the host of the 'from' attribute on the stanza. Returns false on no such host.
author Matthew Wild <mwild1@gmail.com>
date Fri, 21 Nov 2008 05:59:03 +0000
parents 371:0dc5819660e8
children 373:dd0345edeaf4 384:4542bcdb7f55
files core/stanza_router.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/core/stanza_router.lua	Fri Nov 21 05:47:27 2008 +0000
+++ b/core/stanza_router.lua	Fri Nov 21 05:59:03 2008 +0000
@@ -208,6 +208,10 @@
 	local from_node, from_host, from_resource = jid_split(from);
 	local from_bare = from_node and (from_node.."@"..from_host) or from_host; -- bare JID
 
+	-- Auto-detect origin if not specified
+	origin = origin or hosts[from_host];
+	if not origin then return false; end
+	
 	if stanza.name == "presence" and (stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable") then resource = nil; end
 
 	local host_session = hosts[host]