aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/adhoc/mod_adhoc.lua
diff options
context:
space:
mode:
authorFlorian Zeitz <florob@babelmonkeys.de>2013-07-24 22:08:07 +0200
committerFlorian Zeitz <florob@babelmonkeys.de>2013-07-24 22:08:07 +0200
commit81410b7371d8acf80d759b827f60229b147f2432 (patch)
tree7b8cb733a4ba5d5de21c6e500872226a45c1a600 /plugins/adhoc/mod_adhoc.lua
parent0f421f9b7ccbe92fb2bc50c3e576550866fbcea9 (diff)
downloadprosody-81410b7371d8acf80d759b827f60229b147f2432.tar.gz
prosody-81410b7371d8acf80d759b827f60229b147f2432.zip
mod_adhoc: Sort commands by node. This guarantees the order remains the same across restarts etc.
Diffstat (limited to 'plugins/adhoc/mod_adhoc.lua')
-rw-r--r--plugins/adhoc/mod_adhoc.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/adhoc/mod_adhoc.lua b/plugins/adhoc/mod_adhoc.lua
index 69b2c8da..73744969 100644
--- a/plugins/adhoc/mod_adhoc.lua
+++ b/plugins/adhoc/mod_adhoc.lua
@@ -6,6 +6,8 @@
--
local st = require "util.stanza";
+local keys = require "util.iterators".keys;
+local array_collect = require "util.array".collect;
local is_admin = require "core.usermanager".is_admin;
local adhoc_handle_cmd = module:require "adhoc".handle_cmd;
local xmlns_cmd = "http://jabber.org/protocol/commands";
@@ -56,7 +58,9 @@ module:hook("iq/host/"..xmlns_disco.."#items:query", function (event)
reply = st.reply(stanza);
reply:tag("query", { xmlns = xmlns_disco.."#items",
node = xmlns_cmd });
- for node, command in pairs(commands) do
+ local nodes = array_collect(keys(commands)):sort();
+ for _, node in ipairs(nodes) do
+ local command = commands[node];
if (command.permission == "admin" and admin)
or (command.permission == "global_admin" and global_admin)
or (command.permission == "user") then