Software /
code /
prosody
Comparison
plugins/mod_admin_telnet.lua @ 5227:97f395938028
mod_admin_telnet: Improve wording when listing users
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 09 Dec 2012 11:44:45 +0100 |
parent | 5186:ad898e50b8f3 |
child | 5270:20e14961f630 |
comparison
equal
deleted
inserted
replaced
5225:079e4cb23f89 | 5227:97f395938028 |
---|---|
958 return nil, "No host given"; | 958 return nil, "No host given"; |
959 elseif not hosts[host] then | 959 elseif not hosts[host] then |
960 return nil, "No such host"; | 960 return nil, "No such host"; |
961 end | 961 end |
962 local print = self.session.print; | 962 local print = self.session.print; |
963 local count = 0; | 963 local total, matches = 0, 0; |
964 for user in um.users(host) do | 964 for user in um.users(host) do |
965 if not pat or user:match(pat) then | 965 if not pat or user:match(pat) then |
966 print(user.."@"..host); | 966 print(user.."@"..host); |
967 end | 967 matches = matches + 1; |
968 count = count + 1; | 968 end |
969 end | 969 total = total + 1; |
970 return true, count .. " users total"; | 970 end |
971 return true, "Showing "..(pat and (matches.." of ") or "all " )..total.." users"; | |
971 end | 972 end |
972 | 973 |
973 def_env.xmpp = {}; | 974 def_env.xmpp = {}; |
974 | 975 |
975 local st = require "util.stanza"; | 976 local st = require "util.stanza"; |