Diff

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
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Tue Dec 04 20:08:44 2012 +0000
+++ b/plugins/mod_admin_telnet.lua	Sun Dec 09 11:44:45 2012 +0100
@@ -960,14 +960,15 @@
 		return nil, "No such host";
 	end
 	local print = self.session.print;
-	local count = 0;
+	local total, matches = 0, 0;
 	for user in um.users(host) do
 		if not pat or user:match(pat) then
 			print(user.."@"..host);
+			matches = matches + 1;
 		end
-		count = count + 1;
+		total = total + 1;
 	end
-	return true, count .. " users total";
+	return true, "Showing "..(pat and (matches.." of ") or "all " )..total.." users";
 end
 
 def_env.xmpp = {};