aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_admin_telnet.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-10-14 22:53:41 +0200
committerKim Alvefur <zash@zash.se>2012-10-14 22:53:41 +0200
commitdbac5db2dabdfdb13632b0b64f59d1c2cd2b77c6 (patch)
tree0fcfafb96064def71df05ea9765e4141bfc89a1c /plugins/mod_admin_telnet.lua
parent38f89dfe3fb1cff7b6f7dc873881dc439990eb33 (diff)
parent1dad7f3278cab2865dbfe0719b5b3daff853e2c2 (diff)
downloadprosody-dbac5db2dabdfdb13632b0b64f59d1c2cd2b77c6.tar.gz
prosody-dbac5db2dabdfdb13632b0b64f59d1c2cd2b77c6.zip
Merge 0.9 -> trunk
Diffstat (limited to 'plugins/mod_admin_telnet.lua')
-rw-r--r--plugins/mod_admin_telnet.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 9d3186d6..e9d595ba 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -228,7 +228,7 @@ function commands.help(session, data)
print [[user:create(jid, password) - Create the specified user account]]
print [[user:password(jid, password) - Set the password for the specified user account]]
print [[user:delete(jid) - Permanently remove the specified user account]]
- print [[user:list(hostname) - List users on the specified host]]
+ print [[user:list(hostname, pattern) - List users on the specified host, optionally filtering with a pattern]]
elseif section == "server" then
print [[server:version() - Show the server's version number]]
print [[server:uptime() - Show how long the server has been running]]
@@ -953,15 +953,21 @@ function def_env.user:password(jid, password)
end
end
-function def_env.user:list(host)
+function def_env.user:list(host, pat)
if not host then
return nil, "No host given";
+ elseif not hosts[host] then
+ return nil, "No such host";
end
local print = self.session.print;
+ local count = 0;
for user in um.users(host) do
- print(user.."@"..host);
+ if not pat or user:match(pat) then
+ print(user.."@"..host);
+ end
+ count = count + 1;
end
- return true;
+ return true, count .. " users total";
end
def_env.xmpp = {};