Comparison

plugins/mod_component.lua @ 3617:26c9ba8f309c

mod_component: Use module:get_option() instead of configmanager.
author Waqas Hussain <waqas20@gmail.com>
date Fri, 12 Nov 2010 23:35:02 +0500
parent 3616:95ae7af2c82b
child 3618:321767e78029
comparison
equal deleted inserted replaced
3616:95ae7af2c82b 3617:26c9ba8f309c
12 12
13 local hosts = _G.hosts; 13 local hosts = _G.hosts;
14 14
15 local t_concat = table.concat; 15 local t_concat = table.concat;
16 16
17 local config = require "core.configmanager";
18 local sha1 = require "util.hashes".sha1; 17 local sha1 = require "util.hashes".sha1;
19 local st = require "util.stanza"; 18 local st = require "util.stanza";
20 19
21 local log = module._log; 20 local log = module._log;
22 21
66 (session.log or log)("warn", "Component handshake invalid"); 65 (session.log or log)("warn", "Component handshake invalid");
67 session:close("not-authorized"); 66 session:close("not-authorized");
68 return true; 67 return true;
69 end 68 end
70 69
71 local secret = config.get(session.host, "core", "component_secret"); 70 local secret = module:get_option("component_secret");
72 if not secret then 71 if not secret then
73 (session.log or log)("warn", "Component attempted to identify as %s, but component_secret is not set", session.host); 72 (session.log or log)("warn", "Component attempted to identify as %s, but component_secret is not set", session.host);
74 session:close("not-authorized"); 73 session:close("not-authorized");
75 return true; 74 return true;
76 end 75 end