aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/stanza_router.lua4
1 files changed, 4 insertions, 0 deletions
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]