plugins/various: Use type-specific config API
authorKim Alvefur <zash@zash.se>
Thu, 16 Mar 2017 20:46:06 +0100
changeset 7980 01d6298de991
parent 7979 2a7ef5fcaa77
child 7981 01aa6344a556
plugins/various: Use type-specific config API
plugins/mod_admin_telnet.lua
plugins/mod_disco.lua
plugins/mod_http_files.lua
plugins/mod_version.lua
--- a/plugins/mod_admin_telnet.lua	Thu Mar 16 19:09:57 2017 +0100
+++ b/plugins/mod_admin_telnet.lua	Thu Mar 16 20:46:06 2017 +0100
@@ -1111,7 +1111,7 @@
 	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 @@
 		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
--- a/plugins/mod_disco.lua	Thu Mar 16 19:09:57 2017 +0100
+++ b/plugins/mod_disco.lua	Thu Mar 16 20:46:06 2017 +0100
@@ -13,7 +13,7 @@
 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;
--- a/plugins/mod_http_files.lua	Thu Mar 16 19:09:57 2017 +0100
+++ b/plugins/mod_http_files.lua	Thu Mar 16 20:46:06 2017 +0100
@@ -19,7 +19,7 @@
 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;
--- a/plugins/mod_version.lua	Thu Mar 16 19:09:57 2017 +0100
+++ b/plugins/mod_version.lua	Thu Mar 16 20:46:06 2017 +0100
@@ -16,11 +16,11 @@
 	: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;