local sessionmanager = require "core.sessionmanager";\r
local offlinemanager = require "core.offlinemanager";\r
\r
+local _core_route_stanza = core_route_stanza;\r
+local core_route_stanza;\r
+function core_route_stanza(origin, stanza)\r
+ if stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" and stanza.attr.type ~= "error" then\r
+ local node, host = jid_split(stanza.attr.to);\r
+ host = hosts[host];\r
+ if host and host.type == "local" then\r
+ handle_inbound_presence_subscriptions_and_probes(origin, stanza, jid_bare(stanza.attr.from), jid_bare(stanza.attr.to), core_route_stanza);\r
+ return;\r
+ end\r
+ end\r
+ _core_route_stanza(origin, stanza);\r
+end\r
+\r
function handle_presence(origin, stanza, from_bare, to_bare, core_route_stanza, inbound)\r
local type = stanza.attr.type;\r
if type and type ~= "unavailable" and type ~= "error" then\r
end\r
local node, host = jid_split(stanza.attr.from);\r
for _, res in pairs(hosts[host].sessions[node].sessions) do -- broadcast to all resources\r
- if res ~= origin and res.full_jid then -- to resource. FIXME is res.full_jid the correct check? Maybe it should be res.presence\r
+ if res ~= origin and res.presence then -- to resource\r
stanza.attr.to = res.full_jid;\r
core_route_stanza(origin, stanza);\r
end\r
core_route_stanza(origin, stanza);\r
end\r
end\r
+ return true;\r
end\r
\r
local add_handler = require "core.eventmanager2".add_handler;\r