Software / code / prosody
Comparison
plugins/mod_admin_telnet.lua @ 7070:aab022cb8e29
mod_admin_telnet: c2s:count in less lines
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 10 Jan 2016 00:00:22 +0100 |
| parent | 7069:eae5d2f1311d |
| child | 7074:3ff83773ffc0 |
| child | 7090:7aa37d70944b |
comparison
equal
deleted
inserted
replaced
| 7069:eae5d2f1311d | 7070:aab022cb8e29 |
|---|---|
| 566 callback(get_jid(session), session) | 566 callback(get_jid(session), session) |
| 567 end); | 567 end); |
| 568 end | 568 end |
| 569 | 569 |
| 570 function def_env.c2s:count(match_jid) | 570 function def_env.c2s:count(match_jid) |
| 571 local count = 0; | 571 return true, "Total: ".. iterators.count(values(module:shared"/*/c2s/sessions")) .." clients"; |
| 572 show_c2s(function (jid, session) | |
| 573 if (not match_jid) or jid:match(match_jid) then | |
| 574 count = count + 1; | |
| 575 end | |
| 576 end); | |
| 577 return true, "Total: "..count.." clients"; | |
| 578 end | 572 end |
| 579 | 573 |
| 580 function def_env.c2s:show(match_jid, annotate) | 574 function def_env.c2s:show(match_jid, annotate) |
| 581 local print, count = self.session.print, 0; | 575 local print, count = self.session.print, 0; |
| 582 annotate = annotate or session_flags; | 576 annotate = annotate or session_flags; |