# HG changeset patch # User Kim Alvefur # Date 1576877487 -3600 # Node ID 48300484a12435aaf7332c08189446dd84681f4d # Parent d59be9befad76f7fad8f36a5506c2b0e1986e236 core.stanza_router: Extract host part of JIDs directly [luacheck] Silences warning about unused return values diff -r d59be9befad7 -r 48300484a124 core/stanza_router.lua --- a/core/stanza_router.lua Fri Dec 20 22:23:22 2019 +0100 +++ b/core/stanza_router.lua Fri Dec 20 22:31:27 2019 +0100 @@ -12,6 +12,7 @@ local tostring = tostring; local st = require "util.stanza"; local jid_split = require "util.jid".split; +local jid_host = require "util.jid".host; local jid_prepped_split = require "util.jid".prepped_split; local full_sessions = _G.prosody.full_sessions; @@ -81,7 +82,7 @@ local to_bare, from_bare; if to then if full_sessions[to] or bare_sessions[to] or hosts[to] then - node, host = jid_split(to); -- TODO only the host is needed, optimize + host = jid_host(to); else node, host, resource = jid_prepped_split(to); if not host then @@ -186,8 +187,8 @@ end function core_route_stanza(origin, stanza) - local node, host, resource = jid_split(stanza.attr.to); - local from_node, from_host, from_resource = jid_split(stanza.attr.from); + local host = jid_host(stanza.attr.to); + local from_host = jid_host(stanza.attr.from); -- Auto-detect origin if not specified origin = origin or hosts[from_host];