Software / code / prosody
Comparison
core/modulemanager.lua @ 1993:09621f8d0366
modulemanager: Use componentmanager to create new components.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Sun, 18 Oct 2009 03:15:33 +0500 |
| parent | 1988:a6e7fe0fc3dd |
| child | 1994:9cc9b096c8f5 |
comparison
equal
deleted
inserted
replaced
| 1992:bbaba17537a9 | 1993:09621f8d0366 |
|---|---|
| 126 local api_instance = setmetatable({ name = module_name, host = host, config = config, _log = _log, log = function (self, ...) return _log(...); end }, { __index = api }); | 126 local api_instance = setmetatable({ name = module_name, host = host, config = config, _log = _log, log = function (self, ...) return _log(...); end }, { __index = api }); |
| 127 | 127 |
| 128 local pluginenv = setmetatable({ module = api_instance }, { __index = _G }); | 128 local pluginenv = setmetatable({ module = api_instance }, { __index = _G }); |
| 129 | 129 |
| 130 setfenv(mod, pluginenv); | 130 setfenv(mod, pluginenv); |
| 131 if not hosts[host] then hosts[host] = { type = "component", host = host, connected = false, s2sout = {} }; end | 131 if not hosts[host] then |
| 132 local create_component = _G.require "core.componentmanager".create_component; | |
| 133 hosts[host] = create_component(host); | |
| 134 hosts[host].connected = false; | |
| 135 log("debug", "Created new component: %s", host); | |
| 136 end | |
| 132 hosts[host].modules = modulemap[host]; | 137 hosts[host].modules = modulemap[host]; |
| 133 | 138 |
| 134 local success, ret = pcall(mod); | 139 local success, ret = pcall(mod); |
| 135 if not success then | 140 if not success then |
| 136 log("error", "Error initialising module '%s': %s", module_name or "nil", ret or "nil"); | 141 log("error", "Error initialising module '%s': %s", module_name or "nil", ret or "nil"); |