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
commite157445db73e3901eced621c1117a1ea508ea4b6 (patch)
treeb64e7d91badb210f2c1e3a857ddf921b164fb8aa /core/moduleapi.lua
parentabea06b4d569016d7f83429c90635edb451c9b3b (diff)
parentc596e86388de98d061508b5659f7ad1652654ca0 (diff)
downloadprosody-e157445db73e3901eced621c1117a1ea508ea4b6.tar.gz
prosody-e157445db73e3901eced621c1117a1ea508ea4b6.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