Just realized I did not attach the patch. Here it is.
On 29/09/2024 18.12, Aidan Epstein wrote:
Right now messages are just logged as "<host>:admin_adhoc: mod_(nil)
reloaded by <me>".
Thanks!
--
You received this message because you are subscribed to the Google Groups
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prosody-dev/eec63177-1cbc-4056-b7f2-42cfccb78bbb%40jmad.org.
# HG changeset patch
# User Aidan Epstein <[email protected]>
# Date 1727658557 25200
# Sun Sep 29 18:09:17 2024 -0700
# Node ID 987253d83bc8ffb862fd230982eb8498cc8c3d3b
# Parent 328bea338503b8ef716b22e94afce36499acdc2b
mod_admin_adhoc: Fix log messages for reloading modules.
Also rename for loop item so that it doesn't shadow module variable.
diff -r 328bea338503 -r 987253d83bc8 plugins/mod_admin_adhoc.lua
--- a/plugins/mod_admin_adhoc.lua Sat Sep 28 12:38:42 2024 -0700
+++ b/plugins/mod_admin_adhoc.lua Sun Sep 29 18:09:17 2024 -0700
@@ -592,15 +592,15 @@
return generate_error_message(err);
end
local ok_list, err_list = {}, {};
- for _, module in ipairs(fields.modules) do
- local ok, err = modulemanager.reload(module_host, module);
+ for _, module_ in ipairs(fields.modules) do
+ local ok, err = modulemanager.reload(module_host, module_);
if ok then
- ok_list[#ok_list + 1] = module;
+ ok_list[#ok_list + 1] = module_;
else
- err_list[#err_list + 1] = module .. "(Error: " .. tostring(err) .. ")";
+ err_list[#err_list + 1] = module_ .. "(Error: " .. tostring(err) .. ")";
end
+ module:log("info", "mod_%s reloaded by %s", module_, jid.bare(data.from));
end
- module:log("info", "mod_%s reloaded by %s", fields.module, jid.bare(data.from));
local info = (#ok_list > 0 and ("The following modules were successfully reloaded on host "..module_host..":\n"..t_concat(ok_list, "\n")) or "")
.. ((#ok_list > 0 and #err_list > 0) and "\n" or "") ..
(#err_list > 0 and ("Failed to reload the following modules on host "..module_host..":\n"..t_concat(err_list, "\n")) or "");
@@ -742,15 +742,15 @@
return generate_error_message(err);
end
local ok_list, err_list = {}, {};
- for _, module in ipairs(fields.modules) do
- local ok, err = modulemanager.unload(module_host, module);
+ for _, module_ in ipairs(fields.modules) do
+ local ok, err = modulemanager.unload(module_host, module_);
if ok then
- ok_list[#ok_list + 1] = module;
+ ok_list[#ok_list + 1] = module_;
else
- err_list[#err_list + 1] = module .. "(Error: " .. tostring(err) .. ")";
+ err_list[#err_list + 1] = module_ .. "(Error: " .. tostring(err) .. ")";
end
+ module:log("info", "mod_%s unloaded by %s", module_, jid.bare(data.from));
end
- module:log("info", "mod_%s unloaded by %s", fields.module, jid.bare(data.from));
local info = (#ok_list > 0 and ("The following modules were successfully unloaded on host "..module_host..":\n"..t_concat(ok_list, "\n")) or "")
.. ((#ok_list > 0 and #err_list > 0) and "\n" or "") ..
(#err_list > 0 and ("Failed to unload the following modules on host "..module_host..":\n"..t_concat(err_list, "\n")) or "");