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.

Fri, 21 Nov 2008 05:59:03 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 21 Nov 2008 05:59:03 +0000
changeset 372
e7c1e30d06d5
parent 371
0dc5819660e8
child 373
dd0345edeaf4
child 384
4542bcdb7f55

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.

core/stanza_router.lua file | annotate | diff | comparison | revisions
--- 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]

mercurial