From 3b1d2b2963e15660f198804f2f19d10ba0380af2 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 21 Nov 2008 05:59:03 +0000 Subject: 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/stanza_router.lua b/core/stanza_router.lua index a3837ddd..2505fca3 100644 --- a/core/stanza_router.lua +++ b/core/stanza_router.lua @@ -208,6 +208,10 @@ function core_route_stanza(origin, stanza) 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] -- cgit v1.2.3