Comparison

plugins/mod_admin_telnet.lua @ 4779:9f2639b3d9b1

mod_admin_telnet: Add c2s:count() which shows number of connected users.
author Kim Alvefur <zash@zash.se>
date Sat, 28 Apr 2012 17:18:03 +0200
parent 4684:dc70c4ffb66d
child 4807:2999f0fd1347
comparison
equal deleted inserted replaced
4776:dbe9d75c0452 4779:9f2639b3d9b1
438 end 438 end
439 end 439 end
440 end 440 end
441 end 441 end
442 442
443 function def_env.c2s:count(match_jid)
444 local count = 0;
445 show_c2s(function (jid, session)
446 if (not match_jid) or jid:match(match_jid) then
447 count = count + 1;
448 end
449 end);
450 return true, "Total: "..count.." clients";
451 end
452
443 function def_env.c2s:show(match_jid) 453 function def_env.c2s:show(match_jid)
444 local print, count = self.session.print, 0; 454 local print, count = self.session.print, 0;
445 local curr_host; 455 local curr_host;
446 show_c2s(function (jid, session) 456 show_c2s(function (jid, session)
447 if curr_host ~= session.host then 457 if curr_host ~= session.host then