Software / code / prosody
Comparison
core/hostmanager.lua @ 6430:ceaf2a0d05eb
hostmanager: Don't prevent host_session.send() from routing errors or iq results, so modules can handle them. This code was originally added for a reason, but I can't remember what it was.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 26 Sep 2014 17:10:43 +0100 |
| parent | 6299:a1da78658a82 |
| child | 6557:8aa967c81cbc |
comparison
equal
deleted
inserted
replaced
| 6429:675aea867574 | 6430:ceaf2a0d05eb |
|---|---|
| 54 end | 54 end |
| 55 | 55 |
| 56 prosody_events.add_handler("server-starting", load_enabled_hosts); | 56 prosody_events.add_handler("server-starting", load_enabled_hosts); |
| 57 | 57 |
| 58 local function host_send(stanza) | 58 local function host_send(stanza) |
| 59 local name, type = stanza.name, stanza.attr.type; | |
| 60 if type == "error" or (name == "iq" and type == "result") then | |
| 61 local dest_host_name = select(2, jid_split(stanza.attr.to)); | |
| 62 local dest_host = hosts[dest_host_name] or { type = "unknown" }; | |
| 63 log("warn", "Unhandled response sent to %s host %s: %s", dest_host.type, dest_host_name, tostring(stanza)); | |
| 64 return; | |
| 65 end | |
| 66 core_route_stanza(nil, stanza); | 59 core_route_stanza(nil, stanza); |
| 67 end | 60 end |
| 68 | 61 |
| 69 function activate(host, host_config) | 62 function activate(host, host_config) |
| 70 if rawget(hosts, host) then return nil, "The host "..host.." is already activated"; end | 63 if rawget(hosts, host) then return nil, "The host "..host.." is already activated"; end |