Changeset

2318:3e5828e3f17f

mod_server_contact_info: Log error when no addresses or admins are set
author Kim Alvefur <zash@zash.se>
date Sat, 01 Oct 2016 17:15:03 +0200
parents 2317:465b34fdeb60
children 2319:86128b948fed
files mod_server_contact_info/mod_server_contact_info.lua
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mod_server_contact_info/mod_server_contact_info.lua	Sat Oct 01 17:13:57 2016 +0200
+++ b/mod_server_contact_info/mod_server_contact_info.lua	Sat Oct 01 17:15:03 2016 +0200
@@ -14,10 +14,10 @@
 }
 
 local contact_config = module:get_option("contact_info");
-if not contact_config then -- we'll use admins from the config as default
+if not contact_config or not next(contact_config) then -- we'll use admins from the config as default
 	local admins = module:get_option_inherited_set("admins", {});
 	if admins:empty() then
-		module:log("debug", "No contact_info or admins in config");
+		module:log("error", "No contact_info or admins set in config");
 		return -- Nothing to attach, so we'll just skip it.
 	end
 	module:log("debug", "No contact_info in config, using admins as fallback");
@@ -25,10 +25,7 @@
 		admin = array.collect( admins / function(admin) return "xmpp:" .. admin; end);
 	};
 end
-if not next(contact_config) then
-	module:log("debug", "No contacts, skipping");
-	return -- No use in serving an empty form.
-end
+
 local form_layout = {
 	{ value = "http://jabber.org/network/serverinfo"; type = "hidden"; name = "FORM_TYPE"; };
 };