Software /
code /
prosody
Changeset
4498:9454d237cf7c
hostmanager: Add send() method to hosts
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 16 Dec 2011 16:01:59 +0000 |
parents | 4497:f42a0833c47c |
children | 4499:55ef5d83d00a |
files | core/hostmanager.lua |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/core/hostmanager.lua Tue Jan 31 22:41:21 2012 +0000 +++ b/core/hostmanager.lua Fri Dec 16 16:01:59 2011 +0000 @@ -53,6 +53,17 @@ prosody_events.add_handler("server-starting", load_enabled_hosts); +local function host_send(stanza) + local name, type = stanza.name, stanza.attr.type; + if type == "error" or (name == "iq" and type == "result") then + local dest_host_name = select(2, jid_split(stanza.attr.to)); + local dest_host = hosts[dest_host_name] or { type = "unknown" }; + log("warn", "Unhandled response sent to %s host %s: %s", dest_host.type, dest_host_name, tostring(stanza)); + return; + end + core_route_stanza(nil, stanza); +end + function activate(host, host_config) if hosts[host] then return nil, "The host "..host.." is already activated"; end host_config = host_config or configmanager.getconfig()[host]; @@ -63,6 +74,7 @@ events = events_new(); dialback_secret = configmanager.get(host, "core", "dialback_secret") or uuid_gen(); disallow_s2s = configmanager.get(host, "core", "disallow_s2s"); + send = host_send; }; if not host_config.core.component_module then -- host host_session.type = "local";