Software /
code /
prosody
Changeset
5760:e599d9a367cf
mod_adhoc: Sort commands by node. This guarantees the order remains the same across restarts etc.
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Wed, 24 Jul 2013 22:08:07 +0200 |
parents | 5759:767e29b2cd3a |
children | 5761:91f8cd53584c |
files | plugins/adhoc/mod_adhoc.lua |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/adhoc/mod_adhoc.lua Wed Jul 24 21:50:38 2013 +0200 +++ b/plugins/adhoc/mod_adhoc.lua Wed Jul 24 22:08:07 2013 +0200 @@ -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 @@ 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