plugins/various: Use type-specific config API

This commit is contained in:
Kim Alvefur 2017-03-16 20:46:06 +01:00
parent 0bf98e614f
commit c3d7d52f0d
4 changed files with 6 additions and 6 deletions

View file

@ -1111,7 +1111,7 @@ function def_env.http:list()
for host in pairs(prosody.hosts) do
local http_apps = modulemanager.get_items("http-provider", host);
if #http_apps > 0 then
local http_host = module:context(host):get_option("http_host");
local http_host = module:context(host):get_option_string("http_host");
print("HTTP endpoints on "..host..(http_host and (" (using "..http_host.."):") or ":"));
for _, provider in ipairs(http_apps) do
local url = module:context(host):http_url(provider.name);
@ -1121,7 +1121,7 @@ function def_env.http:list()
end
end
local default_host = module:get_option("http_default_host");
local default_host = module:get_option_string("http_default_host");
if not default_host then
print("HTTP requests to unknown hosts will return 404 Not Found");
else

View file

@ -13,7 +13,7 @@ local jid_bare = require "util.jid".bare;
local st = require "util.stanza"
local calculate_hash = require "util.caps".calculate_hash;
local disco_items = module:get_option("disco_items") or {};
local disco_items = module:get_option_array("disco_items", {})
do -- validate disco_items
for _, item in ipairs(disco_items) do
local err;

View file

@ -19,7 +19,7 @@ local path_sep = package.config:sub(1,1);
local base_path = module:get_option_string("http_files_dir", module:get_option_string("http_path"));
local cache_size = module:get_option_number("http_files_cache_size", 128);
local cache_max_file_size = module:get_option_number("http_files_cache_max_file_size", 4096);
local dir_indices = module:get_option("http_index_files", { "index.html", "index.htm" });
local dir_indices = module:get_option_array("http_index_files", { "index.html", "index.htm" });
local directory_index = module:get_option_boolean("http_dir_listing");
local mime_map = module:shared("/*/http_files/mime").types;

View file

@ -16,11 +16,11 @@ local query = st.stanza("query", {xmlns = "jabber:iq:version"})
:tag("name"):text("Prosody"):up()
:tag("version"):text(prosody.version):up();
if not module:get_option("hide_os_type") then
if not module:get_option_boolean("hide_os_type") then
if os.getenv("WINDIR") then
version = "Windows";
else
local os_version_command = module:get_option("os_version_command");
local os_version_command = module:get_option_string("os_version_command");
local ok, pposix = pcall(require, "util.pposix");
if not os_version_command and (ok and pposix and pposix.uname) then
version = pposix.uname().sysname;