Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
5157:0e1686f334b8 | 5158:c363e7e77f79 |
---|---|
226 print [[host:list() - List the currently-activated hosts]] | 226 print [[host:list() - List the currently-activated hosts]] |
227 elseif section == "user" then | 227 elseif section == "user" then |
228 print [[user:create(jid, password) - Create the specified user account]] | 228 print [[user:create(jid, password) - Create the specified user account]] |
229 print [[user:password(jid, password) - Set the password for the specified user account]] | 229 print [[user:password(jid, password) - Set the password for the specified user account]] |
230 print [[user:delete(jid) - Permanently remove the specified user account]] | 230 print [[user:delete(jid) - Permanently remove the specified user account]] |
231 print [[host:list(hostname) - List users on the specified host]] | |
231 elseif section == "server" then | 232 elseif section == "server" then |
232 print [[server:version() - Show the server's version number]] | 233 print [[server:version() - Show the server's version number]] |
233 print [[server:uptime() - Show how long the server has been running]] | 234 print [[server:uptime() - Show how long the server has been running]] |
234 print [[server:shutdown(reason) - Shut down the server, with an optional reason to be broadcast to all connections]] | 235 print [[server:shutdown(reason) - Shut down the server, with an optional reason to be broadcast to all connections]] |
235 elseif section == "config" then | 236 elseif section == "config" then |
950 else | 951 else |
951 return nil, "Could not change password for user: "..err; | 952 return nil, "Could not change password for user: "..err; |
952 end | 953 end |
953 end | 954 end |
954 | 955 |
956 function def_env.user:list(host) | |
957 if not host then | |
958 return nil, "No host given"; | |
959 end | |
960 local print = self.session.print; | |
961 for user in um.users(host) do | |
962 print(user.."@"..host); | |
963 end | |
964 return true; | |
965 end | |
966 | |
955 def_env.xmpp = {}; | 967 def_env.xmpp = {}; |
956 | 968 |
957 local st = require "util.stanza"; | 969 local st = require "util.stanza"; |
958 function def_env.xmpp:ping(localhost, remotehost) | 970 function def_env.xmpp:ping(localhost, remotehost) |
959 if hosts[localhost] then | 971 if hosts[localhost] then |