mod_server_contact_info: Log error when no addresses or admins are set

Sat, 01 Oct 2016 17:15:03 +0200

author
Kim Alvefur <zash@zash.se>
date
Sat, 01 Oct 2016 17:15:03 +0200
changeset 2318
3e5828e3f17f
parent 2317
465b34fdeb60
child 2319
86128b948fed

mod_server_contact_info: Log error when no addresses or admins are set

mod_server_contact_info/mod_server_contact_info.lua file | annotate | diff | comparison | revisions
--- 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"; };
 };

mercurial