Diff

plugins/mod_admin_telnet.lua @ 5158:c363e7e77f79

mod_admin_telnet: Add support for listing users
author Kim Alvefur <zash@zash.se>
date Fri, 21 Sep 2012 17:26:54 +0200
parent 5133:1443d1c37c6c
child 5159:0638ff1e1a5a
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Fri Sep 21 17:26:25 2012 +0200
+++ b/plugins/mod_admin_telnet.lua	Fri Sep 21 17:26:54 2012 +0200
@@ -228,6 +228,7 @@
 		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 [[host:list(hostname) - List users on the specified host]]
 	elseif section == "server" then
 		print [[server:version() - Show the server's version number]]
 		print [[server:uptime() - Show how long the server has been running]]
@@ -952,6 +953,17 @@
 	end
 end
 
+function def_env.user:list(host)
+	if not host then
+		return nil, "No host given";
+	end
+	local print = self.session.print;
+	for user in um.users(host) do
+		print(user.."@"..host);
+	end
+	return true;
+end
+
 def_env.xmpp = {};
 
 local st = require "util.stanza";