Software /
code /
prosody
Comparison
plugins/mod_admin_telnet.lua @ 6171:c69fca37f338
mod_admin_telnet: Move extraction of c2s presence info into session_flags()
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 11 May 2014 19:03:23 +0200 |
parent | 6170:1dff425ffe84 |
child | 6172:0205b97bb355 |
comparison
equal
deleted
inserted
replaced
6170:1dff425ffe84 | 6171:c69fca37f338 |
---|---|
490 function def_env.hosts:add(name) | 490 function def_env.hosts:add(name) |
491 end | 491 end |
492 | 492 |
493 local function session_flags(session, line) | 493 local function session_flags(session, line) |
494 line = line or {}; | 494 line = line or {}; |
495 if session.type == "c2s" then | |
496 local status, priority = "unavailable", tostring(session.priority or "-"); | |
497 if session.presence then | |
498 status = session.presence:get_child_text("show") or "available"; | |
499 end | |
500 line[#line+1] = status.."("..priority..")"; | |
501 end | |
495 if session.cert_identity_status == "valid" then | 502 if session.cert_identity_status == "valid" then |
496 line[#line+1] = "(authenticated)"; | 503 line[#line+1] = "(authenticated)"; |
497 end | 504 end |
498 if session.secure then | 505 if session.secure then |
499 line[#line+1] = "(encrypted)"; | 506 line[#line+1] = "(encrypted)"; |
541 curr_host = session.host; | 548 curr_host = session.host; |
542 print(curr_host); | 549 print(curr_host); |
543 end | 550 end |
544 if (not match_jid) or jid:match(match_jid) then | 551 if (not match_jid) or jid:match(match_jid) then |
545 count = count + 1; | 552 count = count + 1; |
546 local status, priority = "unavailable", tostring(session.priority or "-"); | 553 print(session_flags(session, { " ", jid })); |
547 if session.presence then | |
548 status = session.presence:get_child_text("show") or "available"; | |
549 end | |
550 print(session_flags(session, { " "..jid.." - "..status.."("..priority..")" })); | |
551 end | 554 end |
552 end); | 555 end); |
553 return true, "Total: "..count.." clients"; | 556 return true, "Total: "..count.." clients"; |
554 end | 557 end |
555 | 558 |