Software /
code /
prosody
Comparison
plugins/mod_admin_shell.lua @ 12660:e8f57970ced5
mod_admin_shell: Show session role in c2s:show
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 15 Aug 2022 16:36:00 +0200 |
parent | 12638:a47af78a9347 |
child | 12668:5d85de8b0723 |
comparison
equal
deleted
inserted
replaced
12659:c0eea4f6c739 | 12660:e8f57970ced5 |
---|---|
941 else | 941 else |
942 return "Completed"; | 942 return "Completed"; |
943 end | 943 end |
944 end | 944 end |
945 }; | 945 }; |
946 role = { | |
947 title = "Role"; | |
948 description = "Session role"; | |
949 width = 20; | |
950 key = "role"; | |
951 mapper = function(role) | |
952 return role.name; | |
953 end; | |
954 } | |
946 }; | 955 }; |
947 | 956 |
948 local function get_colspec(colspec, default) | 957 local function get_colspec(colspec, default) |
949 if type(colspec) == "string" then colspec = array(colspec:gmatch("%S+")); end | 958 if type(colspec) == "string" then colspec = array(colspec:gmatch("%S+")); end |
950 local columns = {}; | 959 local columns = {}; |
961 return columns; | 970 return columns; |
962 end | 971 end |
963 | 972 |
964 function def_env.c2s:show(match_jid, colspec) | 973 function def_env.c2s:show(match_jid, colspec) |
965 local print = self.session.print; | 974 local print = self.session.print; |
966 local columns = get_colspec(colspec, { "id"; "jid"; "ipv"; "status"; "secure"; "smacks"; "csi" }); | 975 local columns = get_colspec(colspec, { "id"; "jid"; "role"; "ipv"; "status"; "secure"; "smacks"; "csi" }); |
967 local row = format_table(columns, self.session.width); | 976 local row = format_table(columns, self.session.width); |
968 | 977 |
969 local function match(session) | 978 local function match(session) |
970 local jid = get_jid(session) | 979 local jid = get_jid(session) |
971 return (not match_jid) or jid == match_jid; | 980 return (not match_jid) or jid == match_jid; |