diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-04-27 18:03:19 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-04-27 18:03:19 +0100 |
commit | abea06b4d569016d7f83429c90635edb451c9b3b (patch) | |
tree | 2d67224cca878b9859de4556ff2e196310e9b23b /core | |
parent | fe7921945ccf504691a774adf1f94465e975b836 (diff) | |
parent | bcc1074dd55582c565d0fe6349f3eb686d2f6fab (diff) | |
download | prosody-abea06b4d569016d7f83429c90635edb451c9b3b.tar.gz prosody-abea06b4d569016d7f83429c90635edb451c9b3b.zip |
Merge 0.9->trunk
Diffstat (limited to 'core')
-rw-r--r-- | core/moduleapi.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua index 30360f73..9baf4fba 100644 --- a/core/moduleapi.lua +++ b/core/moduleapi.lua @@ -270,6 +270,22 @@ function api:get_option_set(name, ...) return set.new(value); end +function api:get_option_inherited_set(name, ...) + local value = self:get_option_set(name, ...); + local global_value = self:context("*"):get_option_set(name, ...); + if not value then + return global_value; + elseif not global_value then + return value; + end + value:include(global_value); + return value; +end + +function api:context(host) + return setmetatable({host=host or "*"}, {__index=self,__newindex=self}); +end + function api:add_item(key, value) self.items = self.items or {}; self.items[key] = self.items[key] or {}; |