X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=core%2Fmodulemanager.lua;h=07a2b1c92011f71414cdccbd9963b7b5d3c497dd;hb=893e9d4df9981fa666c98c0f5dd04920ae91e955;hp=c78c315b2e8d351f4e066f3501f00be3c72897e5;hpb=06b7174c90b4c68002ea11a72ef96924080d8282;p=prosody.git diff --git a/core/modulemanager.lua b/core/modulemanager.lua index c78c315b..07a2b1c9 100644 --- a/core/modulemanager.lua +++ b/core/modulemanager.lua @@ -6,8 +6,6 @@ -- COPYING file in the source package for more information. -- -local plugin_dir = CFG_PLUGINDIR or "./plugins/"; - local logger = require "util.logger"; local log = logger.init("modulemanager"); local config = require "core.configmanager"; @@ -39,8 +37,8 @@ end local array, set = require "util.array", require "util.set"; -local autoload_modules = {"presence", "message", "iq"}; -local component_inheritable_modules = {"tls", "dialback"}; +local autoload_modules = {"presence", "message", "iq", "offline"}; +local component_inheritable_modules = {"tls", "dialback", "iq"}; -- We need this to let modules access the real global namespace local _G = _G; @@ -70,12 +68,18 @@ function load_modules_for_host(host) if host_modules_enabled == global_modules_enabled then host_modules_enabled = nil; end if host_modules_disabled == global_modules_disabled then host_modules_disabled = nil; end - local host_modules = set.new(host_modules_enabled) - set.new(host_modules_disabled); local global_modules = set.new(autoload_modules) + set.new(global_modules_enabled) - set.new(global_modules_disabled); if component then global_modules = set.intersection(set.new(component_inheritable_modules), global_modules); end - local modules = global_modules + host_modules; + local modules = (global_modules + set.new(host_modules_enabled)) - set.new(host_modules_disabled); + + -- COMPAT w/ pre 0.8 + if modules:contains("console") then + log("error", "The mod_console plugin has been renamed to mod_admin_telnet. Please update your config."); + modules:remove("console"); + modules:add("admin_telnet"); + end if component then load(host, component); @@ -113,11 +117,10 @@ function load(host, module_name, config) end local _log = logger.init(host..":"..module_name); - local api_instance = setmetatable({ name = module_name, host = host, config = config, _log = _log, log = function (self, ...) return _log(...); end }, { __index = api }); + local api_instance = setmetatable({ name = module_name, host = host, path = err, config = config, _log = _log, log = function (self, ...) return _log(...); end }, { __index = api }); local pluginenv = setmetatable({ module = api_instance }, { __index = _G }); api_instance.environment = pluginenv; - pluginenv._M = pluginenv; setfenv(mod, pluginenv); hosts[host].modules = modulemap[host];