Mercurial > prosody-modules
changeset 449:08ffbbdafeea
mod_seclabels: Fetch catalog from config.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 05 Oct 2011 21:00:12 +0200 |
parents | 3bf6f102f1cc |
children | fb152d4af082 |
files | mod_seclabels/mod_seclabels.lua |
diffstat | 1 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_seclabels/mod_seclabels.lua Mon Sep 26 02:18:21 2011 +0000 +++ b/mod_seclabels/mod_seclabels.lua Wed Oct 05 21:00:12 2011 +0200 @@ -11,12 +11,20 @@ stanza:tag('feature', {var=xmlns_label_catalog}):up(); end); -local labels = { +local default_labels = { Classified = { SECRET = { color = "black", bgcolor = "aqua", label = "THISISSECRET" }; PUBLIC = { label = "THISISPUBLIC" }; }; }; +local catalog_name, catalog_desc, labels; +function get_conf() + catalog_name = module:get_option_string("security_catalog_name", "Default"); + catalog_desc = module:get_option_string("security_catalog_desc", "My labels"); + labels = module:get_option("security_labels", default_labels); +end +module:hook("config-reloaded",get_conf); +get_conf(); module:hook("iq/self/"..xmlns_label_catalog..":catalog", function (request) local catalog_request = request.stanza.tags[1]; @@ -24,8 +32,8 @@ :tag("catalog", { xmlns = xmlns_label_catalog, to = catalog_request.attr.to, - name = "Default", - desc = "My labels" + name = catalog_name, + desc = catalog_desc }); local function add_labels(catalog, labels, selector)