aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/hostmanager.lua2
-rw-r--r--plugins/mod_mam/mod_mam.lua13
-rwxr-xr-xprosodyctl32
3 files changed, 31 insertions, 16 deletions
diff --git a/core/hostmanager.lua b/core/hostmanager.lua
index d7a585f9..54944e29 100644
--- a/core/hostmanager.lua
+++ b/core/hostmanager.lua
@@ -91,7 +91,7 @@ function activate(host, host_config)
host_session.type = "component";
end
hosts[host] = host_session;
- if not host:match("[@/]") then
+ if not host_config.disco_hidden and not host:match("[@/]") then
disco_items:set(host:match("%.(.*)") or "*", host, host_config.name or true);
end
for option_name in pairs(host_config) do
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index 298c770c..7499c9ea 100644
--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -67,20 +67,18 @@ end
module:hook("iq/self/"..xmlns_mam..":prefs", function(event)
local origin, stanza = event.origin, event.stanza;
local user = origin.username;
- if stanza.attr.type == "get" then
- local prefs = prefs_to_stanza(get_prefs(user));
- local reply = st.reply(stanza):add_child(prefs);
- origin.send(reply);
- else -- type == "set"
+ if stanza.attr.type == "set" then
local new_prefs = stanza:get_child("prefs", xmlns_mam);
local prefs = prefs_from_stanza(new_prefs);
local ok, err = set_prefs(user, prefs);
if not ok then
origin.send(st.error_reply(stanza, "cancel", "internal-server-error", "Error storing preferences: "..tostring(err)));
- else
- origin.send(st.reply(stanza));
+ return true;
end
end
+ local prefs = prefs_to_stanza(get_prefs(user));
+ local reply = st.reply(stanza):add_child(prefs);
+ origin.send(reply);
return true;
end);
@@ -294,6 +292,7 @@ local function message_handler(event, c2s)
end
end);
if #clone_for_storage.tags == 0 then
+ log("debug", "Not archiving stanza: %s (empty when stripped)", stanza:top_tag());
return;
end
else
diff --git a/prosodyctl b/prosodyctl
index 79f0a46d..bb35c641 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -868,8 +868,22 @@ function cert_commands.import(arg)
while arg[1] and prosody.hosts[ arg[1] ] do
table.insert(hostnames, table.remove(arg, 1));
end
+ if hostnames[1] == nil then
+ local domains = os.getenv"RENEWED_DOMAINS"; -- Set if invoked via certbot
+ if domains then
+ for host in domains:gmatch("%S+") do
+ table.insert(hostnames, host);
+ end
+ else
+ for host in pairs(prosody.hosts) do
+ if host ~= "*" and config.get(host, "enabled") ~= false then
+ table.insert(hostnames, host);
+ end
+ end
+ end
+ end
if not arg[1] or arg[1] == "--help" then -- Probably forgot the path
- show_usage("cert import HOSTNAME [HOSTNAME+] /path/to/certs [/other/paths/]+",
+ show_usage("cert import [HOSTNAME+] /path/to/certs [/other/paths/]+",
"Copies certificates to "..cert_basedir);
return 1;
end
@@ -930,13 +944,15 @@ function commands.cert(arg)
end
local subcmd = table.remove(arg, 1);
if type(cert_commands[subcmd]) == "function" then
- if not arg[1] then
- show_message"You need to supply at least one hostname"
- arg = { "--help" };
- end
- if arg[1] ~= "--help" and not hosts[arg[1]] then
- show_message(error_messages["no-such-host"]);
- return 1;
+ if subcmd ~= "import" then -- hostnames are optional for import
+ if not arg[1] then
+ show_message"You need to supply at least one hostname"
+ arg = { "--help" };
+ end
+ if arg[1] ~= "--help" and not hosts[arg[1]] then
+ show_message(error_messages["no-such-host"]);
+ return 1;
+ end
end
return cert_commands[subcmd](arg);
elseif subcmd == "check" then