Comparison

core/componentmanager.lua @ 982:dbbeb73952e6

componentmanager: Improve default component stanza handler
author Matthew Wild <mwild1@gmail.com>
date Sat, 11 Apr 2009 22:23:49 +0100
parent 970:5516f9e66482
child 983:460429a59c83
comparison
equal deleted inserted replaced
981:71fce47dff7b 982:dbbeb73952e6
12 local log = require "util.logger".init("componentmanager"); 12 local log = require "util.logger".init("componentmanager");
13 local configmanager = require "core.configmanager"; 13 local configmanager = require "core.configmanager";
14 local eventmanager = require "core.eventmanager"; 14 local eventmanager = require "core.eventmanager";
15 local modulemanager = require "core.modulemanager"; 15 local modulemanager = require "core.modulemanager";
16 local jid_split = require "util.jid".split; 16 local jid_split = require "util.jid".split;
17 local st = require "util.stanza";
17 local hosts = hosts; 18 local hosts = hosts;
18 19
19 local pairs, type, tostring = pairs, type, tostring; 20 local pairs, type, tostring = pairs, type, tostring;
20 21
21 local components = {}; 22 local components = {};
33 34
34 35
35 module "componentmanager" 36 module "componentmanager"
36 37
37 local function default_component_handler(origin, stanza) 38 local function default_component_handler(origin, stanza)
38 origin.send(st.error_reply(stanza, "wait", "service-unavailable", "Component unavailable")); 39 log("warn", "Stanza being handled by default component, bouncing error");
40 if stanza.attr.type ~= "error" then
41 origin.send(st.error_reply(stanza, "wait", "service-unavailable", "Component unavailable"));
42 end
39 end 43 end
40 44
41 45
42 function load_enabled_components(config) 46 function load_enabled_components(config)
43 local defined_hosts = config or configmanager.getconfig(); 47 local defined_hosts = config or configmanager.getconfig();