diff options
author | Matthew Wild <mwild1@gmail.com> | 2018-09-21 14:37:47 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2018-09-21 14:37:47 +0100 |
commit | b83f34070d07b321df8a5b099c22325e653cf17f (patch) | |
tree | 7d8d96196480da4de0f5790ad043220d200ee772 /plugins/mod_admin_telnet.lua | |
parent | 83b4ed2470176bc8240bb6a47d38b024988a418a (diff) | |
download | prosody-b83f34070d07b321df8a5b099c22325e653cf17f.tar.gz prosody-b83f34070d07b321df8a5b099c22325e653cf17f.zip |
mod_admin_telnet: Split out sort function for clarity
Diffstat (limited to 'plugins/mod_admin_telnet.lua')
-rw-r--r-- | plugins/mod_admin_telnet.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index 363a5c9b..9b8c7ba9 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -404,12 +404,14 @@ function def_env.module:unload(name, hosts) return ok, (ok and "Module unloaded from "..count.." host"..(count ~= 1 and "s" or "")) or ("Last error: "..tostring(err)); end +local function _sort_hosts(a, b) + if a == "*" then return true + elseif b == "*" then return false + else return a < b; end +end + function def_env.module:reload(name, hosts) - hosts = array.collect(get_hosts_set(hosts, name)):sort(function (a, b) - if a == "*" then return true - elseif b == "*" then return false - else return a < b; end - end); + hosts = array.collect(get_hosts_set(hosts, name)):sort(_sort_hosts) -- Reload the module for each host local ok, err, count = true, nil, 0; |