aboutsummaryrefslogtreecommitdiffstats
path: root/core/moduleapi.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-04-29 00:36:04 +0100
committerMatthew Wild <mwild1@gmail.com>2013-04-29 00:36:04 +0100
commitfd324936d0c7a45c9e2b54a3eb4690bf5f46b020 (patch)
treeb64e7d91badb210f2c1e3a857ddf921b164fb8aa /core/moduleapi.lua
parentc5f20ce901c0c929c4ff5378269288e30c6977b4 (diff)
parentf704c2bc9045e92272fdd687c887771754b55007 (diff)
downloadprosody-fd324936d0c7a45c9e2b54a3eb4690bf5f46b020.tar.gz
prosody-fd324936d0c7a45c9e2b54a3eb4690bf5f46b020.zip
Merge 0.9->trunk
Diffstat (limited to 'core/moduleapi.lua')
-rw-r--r--core/moduleapi.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index 9baf4fba..ed75669b 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -319,7 +319,13 @@ function api:handle_items(type, added_cb, removed_cb, existing)
end
function api:provides(name, item)
- if not item then item = self.environment; end
+ -- if not item then item = setmetatable({}, { __index = function(t,k) return rawget(self.environment, k); end }); end
+ if not item then
+ item = {}
+ for k,v in pairs(self.environment) do
+ if k ~= "module" then item[k] = v; end
+ end
+ end
if not item.name then
local item_name = self.name;
-- Strip a provider prefix to find the item name
@@ -329,6 +335,7 @@ function api:provides(name, item)
end
item.name = item_name;
end
+ item._provided_by = self.name;
self:add_item(name.."-provider", item);
end